Skip to main content

Dialog Flow Engine

The 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.

Documentation Status Codestyle Tests License Apache 2.0 Python 3.6, 3.7, 3.8, 3.9 PyPI Downloads

Quick Start

Installation

pip install df_engine

Basic example

from df_engine.core.keywords import GLOBAL, TRANSITIONS, RESPONSE
from df_engine.core import Context, Actor
import df_engine.conditions as cnd
from typing import Union

# create script of dialog
script = {
GLOBAL: {TRANSITIONS: {("flow", "node_hi"): cnd.exact_match("Hi"), ("flow", "node_ok"): cnd.true()}},
"flow": {
"node_hi": {RESPONSE: "Hi!!!"},
"node_ok": {RESPONSE: "Okey"},
},
}

# init actor
actor = Actor(script, start_label=("flow", "node_hi"))


# handler requests
def turn_handler(in_request: str, ctx: Union[Context, dict], actor: Actor):
# Context.cast - gets an object type of [Context, str, dict] returns an object type of Context
ctx = Context.cast(ctx)
# Add in current context a next request of user
ctx.add_request(in_request)
# pass the context into actor and it returns updated context with actor response
ctx = actor(ctx)
# get last actor response from the context
out_response = ctx.last_response
# the next condition branching needs for testing
return out_response, ctx


ctx = {}
while True:
in_request = input("type your answer: ")
out_response, ctx = turn_handler(in_request, ctx, actor)
print(out_response)

When you run this code, you get similar output:

type your answer: hi
Okey
type your answer: Hi
Hi!!!
type your answer: ok
Okey
type your answer: ok
Okey

To get more advanced examples, take a look at examples on GitHub.

Contributing to the Dialog Flow Engine

Please refer to CONTRIBUTING.md.

Metadata

Release files for df-qwerty 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for df-qwerty 0.9.0
File Size Uploaded Provenance Actions
df_qwerty-0.9.0.tar.gz 24.7 kB Without provenance Details for df_qwerty-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for df-qwerty 0.9.0
File Interpreter ABI Platform Actions
df_qwerty-0.9.0-py3-none-any.whl Python 3 none any Details for df_qwerty-0.9.0-py3-none-any.whl

Total release size: 54.1 kB

Release files / df_qwerty-0.9.0.tar.gz

Download URL df_qwerty-0.9.0.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
27f392424942a079d33d1fe23bc731ab9440db9bd675f83fa1ec0c1d221d676e
BLAKE2b-256 checksum
How to use checksums
034caf2ecb9c8f8f77684d66ebf02040eb1af52ea0f19e9c3f2eeb3281a59a59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release files / df_qwerty-0.9.0-py3-none-any.whl

Download URL df_qwerty-0.9.0-py3-none-any.whl
Size 29.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9339f811c53d0895e92e812fba2b146d7f94678b9010172adc1a4def847b147f
BLAKE2b-256 checksum
How to use checksums
333322d7b475de62de29a4a067f1528a51444123fda86c7f865f20eee42166cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Security for df-qwerty 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page