Skip to main content

[There](https://github.com/deepmipt/dialog_flow_db_connector) is an addon for the [Dialog Flow Framework](https://github.com/deepmipt/dialog_flow_engine), a minimalistic open-source engine for conversational services.

Project description

Dialog Flow DB Connector

There is an addon for the Dialog Flow Framework, a minimalistic open-source engine for conversational services.

Dialog Flow DB Connector allows you to to save and retrieve user dialogue states (in the form of a Context object) using various database backends.

Currently, the supported options are:

Aside from this, we offer some interfaces for saving data to your local file system. These are not meant to be used in production, but can be helpful for prototyping your application.

Codestyle Tests License Apache 2.0 Python 3.6, 3.7, 3.8, 3.9

Quick Start

Installation

pip install df-db-connector

Please, note that if you are going to use one of the database backends, you will have to specify an extra or install the corresponding requirements yourself.

pip install df-db-connector[mysql]
pip install df-db-connector[postgresql]
pip install df-db-connector[sqlite]

Basic example

from df_engine.core import Context, Actor
from df_db_connector import SQLConnector
from .script import some_df_script

db = SQLConnector("postgresql://user:password@host:port/dbname")

actor = Actor(some_df_script, start_label=("root", "start"), fallback_label=("root", "fallback"))


def handle_request(request):
user_id = request.args["user_id"]
if user_id not in db:
context = Context(id=user_id)
else:
context = db[user_id]
new_context = actor(context)
db[user_id] = new_context
assert user_id in db
return new_context.last_response

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

Contributing to the Dialog Flow DB Connector

Please refer to CONTRIBUTING.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

df_db_connector-0.1.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

df_db_connector-0.1-py2.py3-none-any.whl (14.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file df_db_connector-0.1.tar.gz.

File metadata

  • Download URL: df_db_connector-0.1.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for df_db_connector-0.1.tar.gz
Algorithm Hash digest
SHA256 54f570d17e2507c3a2d87c06f5c84b1feae0ffa14019863081346760327cd52c
MD5 e7b6a0c59ad2bc230a1265bf966a8c05
BLAKE2b-256 048a2a7add7b06ecef63702cc742c48b3bd5d0582cfcdd74d7aa034cca427b91

See more details on using hashes here.

File details

Details for the file df_db_connector-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for df_db_connector-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0959dac85865c022ba219fd9fda564f3553c86009dd2ffdaabaab1ea2f43d34f
MD5 5ad4596bce793fd486b67c8e4c6a6170
BLAKE2b-256 dc7dee1f7b202e19eeb52f3e64b1086c80f27d618cefe61aaeeecc69588531b5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page