{"id":19287794,"url":"https://github.com/deeppavlov/dialog_flow_engine","last_synced_at":"2025-12-14T06:56:36.398Z","repository":{"id":37092865,"uuid":"382362417","full_name":"deeppavlov/dialog_flow_engine","owner":"deeppavlov","description":"Dialog Flow Engine (DFE) allows you to write conversational services. The service is written by defining a special dialog graph that describes the behavior of the dialog service. The dialog graph contains the dialog script. DFE offers a specialized language (DSL) for quickly writing dialog graphs. You can use it in such services for writing skills for Amazon Alexa and etc, chat-bots for social networks, websites call-centers and etc.","archived":false,"fork":false,"pushed_at":"2022-08-30T11:28:04.000Z","size":3387,"stargazers_count":18,"open_issues_count":2,"forks_count":6,"subscribers_count":3,"default_branch":"dev","last_synced_at":"2024-05-21T21:04:02.780Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deeppavlov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-02T13:56:13.000Z","updated_at":"2023-10-24T23:46:08.000Z","dependencies_parsed_at":"2022-06-24T14:04:30.563Z","dependency_job_id":null,"html_url":"https://github.com/deeppavlov/dialog_flow_engine","commit_stats":null,"previous_names":["deepmipt/dialog_flow_engine"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeppavlov%2Fdialog_flow_engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeppavlov%2Fdialog_flow_engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeppavlov%2Fdialog_flow_engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deeppavlov%2Fdialog_flow_engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deeppavlov","download_url":"https://codeload.github.com/deeppavlov/dialog_flow_engine/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223589135,"owners_count":17169923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T22:07:15.485Z","updated_at":"2025-12-14T06:56:36.339Z","avatar_url":"https://github.com/deeppavlov.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\n# Dialog Flow Engine\n\nThe Dialog Flow Engine (DFE) allows you to write conversational services. The service is written by defining a special dialog graph that describes the behavior of the dialog service. The dialog graph contains the dialog script. DFE offers a specialized language (DSL) for quickly writing dialog graphs. You can use it in such services for writing skills for Amazon Alexa and etc, chat-bots for social networks, websites call-centers and etc. \n\n[![Documentation Status](https://readthedocs.org/projects/dialog-flow-engine/badge/?version=latest)](https://readthedocs.org/projects/dialog-flow-engine/badge/?version=latest)\n[![Codestyle](https://github.com/deepmipt/dialog_flow_engine/workflows/codestyle/badge.svg)](https://github.com/deepmipt/dialog_flow_engine/actions)\n[![Tests](https://github.com/deepmipt/dialog_flow_engine/workflows/test_coverage/badge.svg)](https://github.com/deepmipt/dialog_flow_engine/actions)\n[![License Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/deepmipt/dialog_flow_engine/blob/master/LICENSE)\n![Python 3.6, 3.7, 3.8, 3.9](https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-green.svg)\n[![PyPI](https://img.shields.io/pypi/v/df_engine)](https://pypi.org/project/df_engine/)\n[![Downloads](https://pepy.tech/badge/df_engine)](https://pepy.tech/project/df_engine)\n\n# Quick Start\n## Installation\n```bash\npip install df_engine\n```\n\n## Basic example\n```python\nfrom df_engine.core.keywords import GLOBAL, TRANSITIONS, RESPONSE\nfrom df_engine.core import Context, Actor\nimport df_engine.conditions as cnd\nfrom typing import Union\n\n# create script of dialog\nscript = {\n    GLOBAL: {TRANSITIONS: {(\"flow\", \"node_hi\"): cnd.exact_match(\"Hi\"), (\"flow\", \"node_ok\"): cnd.true()}},\n    \"flow\": {\n        \"node_hi\": {RESPONSE: \"Hi!!!\"},\n        \"node_ok\": {RESPONSE: \"Okey\"},\n    },\n}\n\n# init actor\nactor = Actor(script, start_label=(\"flow\", \"node_hi\"))\n\n\n# handler requests\ndef turn_handler(in_request: str, ctx: Union[Context, dict], actor: Actor):\n    # Context.cast - gets an object type of [Context, str, dict] returns an object type of Context\n    ctx = Context.cast(ctx)\n    # Add in current context a next request of user\n    ctx.add_request(in_request)\n    # pass the context into actor and it returns updated context with actor response\n    ctx = actor(ctx)\n    # get last actor response from the context\n    out_response = ctx.last_response\n    # the next condition branching needs for testing\n    return out_response, ctx\n\n\nctx = {}\nwhile True:\n    in_request = input(\"type your answer: \")\n    out_response, ctx = turn_handler(in_request, ctx, actor)\n    print(out_response)\n\n```\nWhen you run this code, you get similar output:\n```\ntype your answer: hi\nOkey\ntype your answer: Hi\nHi!!!\ntype your answer: ok\nOkey\ntype your answer: ok\nOkey\n\n```\n\nTo get more advanced examples, take a look at [examples](https://github.com/deepmipt/dialog_flow_engine/tree/dev/examples) on GitHub.\n\n# Contributing to the Dialog Flow Engine\n\nPlease refer to [CONTRIBUTING.md](https://github.com/deepmipt/dialog_flow_engine/blob/dev/CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeppavlov%2Fdialog_flow_engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeeppavlov%2Fdialog_flow_engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeppavlov%2Fdialog_flow_engine/lists"}