[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.
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[redis]
pip install df-db-connector[mongodb]
pip install df-db-connector[mysql]
pip install df-db-connector[postgresql]
pip install df-db-connector[sqlite]
pip install df-db-connector[ydb]
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
Built Distribution
File details
Details for the file df_db_connector-0.2.0.tar.gz
.
File metadata
- Download URL: df_db_connector-0.2.0.tar.gz
- Upload date:
- Size: 21.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec786f7e79fdd28075c2f2c51b61fad02d6f3cad9a8582b0b9ddb3f79ad05f87 |
|
MD5 | 878a69d9c1ded24e3e44535717e9f269 |
|
BLAKE2b-256 | 2aa53c131cc44189d7a2bf25b52618f587a0c79d7e3f5690cbe4438c90b38d09 |
File details
Details for the file df_db_connector-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: df_db_connector-0.2.0-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b2e35052e1a328da73c8bb963a7c49d9f84c15c897a820d289be12715f5b888 |
|
MD5 | 8664ffadeba58cc4b78018aaf8336760 |
|
BLAKE2b-256 | 0df50205a7311513c72d5c91ca7395437557f9e13935cfb23e0f34b68e6d407c |