Skip to content

Commit

Permalink
Deploying to gh-pages from @ e101fb3 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
RLKRo committed Dec 27, 2023
0 parents commit 33797cc
Show file tree
Hide file tree
Showing 606 changed files with 207,798 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 07023cba63ba37048badfd1a7682fb0c
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added .doctrees/about_us.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/dff.context_storages.sql.doctree
Binary file not shown.
Binary file added .doctrees/apiref/dff.context_storages.ydb.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/dff.pipeline.conditions.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/dff.pipeline.types.doctree
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/dff.script.core.context.doctree
Binary file not shown.
Binary file added .doctrees/apiref/dff.script.core.keywords.doctree
Binary file not shown.
Binary file added .doctrees/apiref/dff.script.core.message.doctree
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/dff.script.core.script.doctree
Binary file not shown.
Binary file added .doctrees/apiref/dff.script.core.types.doctree
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/dff.script.extras.slots.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/dff.stats.cli.doctree
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/dff.stats.instrumentor.doctree
Binary file not shown.
Binary file added .doctrees/apiref/dff.stats.utils.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/dff.utils.testing.common.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/index_caching.doctree
Binary file not shown.
Binary file added .doctrees/apiref/index_context_storages.doctree
Binary file not shown.
Binary file added .doctrees/apiref/index_db_benchmark.doctree
Binary file not shown.
Binary file not shown.
Binary file added .doctrees/apiref/index_pipeline.doctree
Binary file not shown.
Binary file added .doctrees/apiref/index_script.doctree
Binary file not shown.
Binary file added .doctrees/apiref/index_stats.doctree
Binary file not shown.
Binary file added .doctrees/apiref/index_testing_utils.doctree
Binary file not shown.
Binary file added .doctrees/community.doctree
Binary file not shown.
Binary file added .doctrees/development.doctree
Binary file not shown.
Binary file added .doctrees/environment.pickle
Binary file not shown.
Binary file added .doctrees/examples.doctree
Binary file not shown.
Binary file added .doctrees/get_started.doctree
Binary file not shown.
Binary file added .doctrees/index.doctree
Binary file not shown.
132 changes: 132 additions & 0 deletions .doctrees/nbsphinx/tutorials/tutorials.context_storages.1_basics.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "cf528607",
"metadata": {
"cell_marker": "\"\"\""
},
"source": [
"# 1. Basics\n",
"\n",
"The following tutorial shows the basic use of the database connection.\n",
"\n",
"See [context_storage_factory](../apiref/dff.context_storages.database.rst#dff.context_storages.database.context_storage_factory) function\n",
"for creating a context storage by path.\n",
"\n",
"In this example JSON file is used as a storage."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "785bff8a",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-27T16:49:16.014905Z",
"iopub.status.busy": "2023-12-27T16:49:16.014247Z",
"iopub.status.idle": "2023-12-27T16:49:18.400779Z",
"shell.execute_reply": "2023-12-27T16:49:18.399622Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"# installing dependencies\n",
"%pip install -q dff[json,pickle]"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "eca435ac",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-27T16:49:18.405873Z",
"iopub.status.busy": "2023-12-27T16:49:18.405562Z",
"iopub.status.idle": "2023-12-27T16:49:19.318046Z",
"shell.execute_reply": "2023-12-27T16:49:19.317352Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(user) >>> text='Hi'\n",
" (bot) <<< text='Hi, how are you?'\n",
"(user) >>> text='i'm fine, how are you?'\n",
" (bot) <<< text='Good. What do you want to talk about?'\n",
"(user) >>> text='Let's talk about music.'\n",
" (bot) <<< text='Sorry, I can not talk about music now.'\n",
"(user) >>> text='Ok, goodbye.'\n",
" (bot) <<< text='bye'\n",
"(user) >>> text='Hi'\n",
" (bot) <<< text='Hi, how are you?'\n"
]
}
],
"source": [
"import pathlib\n",
"\n",
"from dff.context_storages import context_storage_factory\n",
"\n",
"from dff.pipeline import Pipeline\n",
"from dff.utils.testing.common import (\n",
" check_happy_path,\n",
" is_interactive_mode,\n",
" run_interactive_mode,\n",
")\n",
"from dff.utils.testing.toy_script import TOY_SCRIPT_ARGS, HAPPY_PATH\n",
"\n",
"pathlib.Path(\"dbs\").mkdir(exist_ok=True)\n",
"db = context_storage_factory(\"json://dbs/file.json\")\n",
"# db = context_storage_factory(\"pickle://dbs/file.pkl\")\n",
"# db = context_storage_factory(\"shelve://dbs/file\")\n",
"\n",
"pipeline = Pipeline.from_script(*TOY_SCRIPT_ARGS, context_storage=db)\n",
"\n",
"if __name__ == \"__main__\":\n",
" check_happy_path(pipeline, HAPPY_PATH)\n",
" # a function for automatic tutorial running (testing) with HAPPY_PATH\n",
"\n",
" # This runs tutorial in interactive mode if not in IPython env\n",
" # and if `DISABLE_INTERACTIVE_MODE` is not set\n",
" if is_interactive_mode():\n",
" run_interactive_mode(pipeline) # This runs tutorial in interactive mode"
]
}
],
"metadata": {
"jupytext": {
"cell_metadata_filter": "-all",
"main_language": "python",
"notebook_metadata_filter": "-all",
"text_representation": {
"extension": ".py",
"format_name": "percent"
}
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "b2141428",
"metadata": {
"cell_marker": "\"\"\""
},
"source": [
"# 2. PostgreSQL\n",
"\n",
"This is a tutorial on using PostgreSQL.\n",
"\n",
"See [SQLContextStorage](../apiref/dff.context_storages.sql.rst#dff.context_storages.sql.SQLContextStorage) class\n",
"for storing your users' contexts in SQL databases.\n",
"\n",
"DFF uses [sqlalchemy](https://docs.sqlalchemy.org/en/20/)\n",
"and [asyncpg](https://magicstack.github.io/asyncpg/current/)\n",
"libraries for asynchronous access to PostgreSQL DB."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "6ae2042c",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-27T16:49:20.999153Z",
"iopub.status.busy": "2023-12-27T16:49:20.998957Z",
"iopub.status.idle": "2023-12-27T16:49:23.325035Z",
"shell.execute_reply": "2023-12-27T16:49:23.324227Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"# installing dependencies\n",
"%pip install -q dff[postgresql]"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "5eb6b286",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-27T16:49:23.328061Z",
"iopub.status.busy": "2023-12-27T16:49:23.327778Z",
"iopub.status.idle": "2023-12-27T16:49:24.063795Z",
"shell.execute_reply": "2023-12-27T16:49:24.062861Z"
},
"lines_to_next_cell": 2
},
"outputs": [],
"source": [
"import os\n",
"\n",
"from dff.context_storages import context_storage_factory\n",
"\n",
"from dff.pipeline import Pipeline\n",
"from dff.utils.testing.common import (\n",
" check_happy_path,\n",
" is_interactive_mode,\n",
" run_interactive_mode,\n",
")\n",
"from dff.utils.testing.toy_script import TOY_SCRIPT_ARGS, HAPPY_PATH"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "95189175",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-27T16:49:24.068078Z",
"iopub.status.busy": "2023-12-27T16:49:24.067471Z",
"iopub.status.idle": "2023-12-27T16:49:24.186954Z",
"shell.execute_reply": "2023-12-27T16:49:24.186204Z"
},
"lines_to_next_cell": 2
},
"outputs": [],
"source": [
"db_uri = \"postgresql+asyncpg://{}:{}@localhost:5432/{}\".format(\n",
" os.environ[\"POSTGRES_USERNAME\"],\n",
" os.environ[\"POSTGRES_PASSWORD\"],\n",
" os.environ[\"POSTGRES_DB\"],\n",
")\n",
"db = context_storage_factory(db_uri)\n",
"\n",
"\n",
"pipeline = Pipeline.from_script(*TOY_SCRIPT_ARGS, context_storage=db)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "5dd744bb",
"metadata": {
"execution": {
"iopub.execute_input": "2023-12-27T16:49:24.189978Z",
"iopub.status.busy": "2023-12-27T16:49:24.189769Z",
"iopub.status.idle": "2023-12-27T16:49:24.216608Z",
"shell.execute_reply": "2023-12-27T16:49:24.215746Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(user) >>> text='Hi'\n",
" (bot) <<< text='Hi, how are you?'\n",
"(user) >>> text='i'm fine, how are you?'\n",
" (bot) <<< text='Good. What do you want to talk about?'\n",
"(user) >>> text='Let's talk about music.'\n",
" (bot) <<< text='Sorry, I can not talk about music now.'\n",
"(user) >>> text='Ok, goodbye.'\n",
" (bot) <<< text='bye'\n",
"(user) >>> text='Hi'\n",
" (bot) <<< text='Hi, how are you?'\n"
]
}
],
"source": [
"if __name__ == \"__main__\":\n",
" check_happy_path(pipeline, HAPPY_PATH)\n",
" if is_interactive_mode():\n",
" run_interactive_mode(pipeline)"
]
}
],
"metadata": {
"jupytext": {
"cell_metadata_filter": "-all",
"main_language": "python",
"notebook_metadata_filter": "-all",
"text_representation": {
"extension": ".py",
"format_name": "percent"
}
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 33797cc

Please sign in to comment.