-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ 1e2b10b 🚀
- Loading branch information
0 parents
commit 1b08578
Showing
600 changed files
with
209,988 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: a41acbca49d4d21e183addf59d2cc021 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
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 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 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 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 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 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 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 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.
129 changes: 129 additions & 0 deletions
129
.doctrees/nbsphinx/tutorials/tutorials.context_storages.1_basics.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "a6054c9a", | ||
"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/chatsky.context_storages.database.rst#chatsky.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": "5445e22f", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-09-07T22:34:27.396138Z", | ||
"iopub.status.busy": "2024-09-07T22:34:27.395718Z", | ||
"iopub.status.idle": "2024-09-07T22:34:29.616938Z", | ||
"shell.execute_reply": "2024-09-07T22:34:29.616005Z" | ||
} | ||
}, | ||
"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 chatsky[json,pickle]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "02d441de", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-09-07T22:34:29.619822Z", | ||
"iopub.status.busy": "2024-09-07T22:34:29.619602Z", | ||
"iopub.status.idle": "2024-09-07T22:34:30.792824Z", | ||
"shell.execute_reply": "2024-09-07T22:34:30.792073Z" | ||
} | ||
}, | ||
"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 chatsky.context_storages import context_storage_factory\n", | ||
"\n", | ||
"from chatsky import Pipeline\n", | ||
"from chatsky.utils.testing.common import (\n", | ||
" check_happy_path,\n", | ||
" is_interactive_mode,\n", | ||
")\n", | ||
"from chatsky.utils.testing.toy_script import TOY_SCRIPT_KWARGS, 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(**TOY_SCRIPT_KWARGS, context_storage=db)\n", | ||
"\n", | ||
"if __name__ == \"__main__\":\n", | ||
" check_happy_path(pipeline, HAPPY_PATH, printout=True)\n", | ||
" # a function for automatic tutorial running (testing) with HAPPY_PATH\n", | ||
"\n", | ||
" if is_interactive_mode():\n", | ||
" pipeline.run()" | ||
] | ||
} | ||
], | ||
"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.19" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
164 changes: 164 additions & 0 deletions
164
.doctrees/nbsphinx/tutorials/tutorials.context_storages.2_postgresql.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "92a9f147", | ||
"metadata": { | ||
"cell_marker": "\"\"\"" | ||
}, | ||
"source": [ | ||
"# 2. PostgreSQL\n", | ||
"\n", | ||
"This is a tutorial on using PostgreSQL.\n", | ||
"\n", | ||
"See [SQLContextStorage](../apiref/chatsky.context_storages.sql.rst#chatsky.context_storages.sql.SQLContextStorage) class\n", | ||
"for storing your users' contexts in SQL databases.\n", | ||
"\n", | ||
"Chatsky 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": "1c946229", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-09-07T22:34:32.344410Z", | ||
"iopub.status.busy": "2024-09-07T22:34:32.344196Z", | ||
"iopub.status.idle": "2024-09-07T22:34:33.541243Z", | ||
"shell.execute_reply": "2024-09-07T22:34:33.540398Z" | ||
} | ||
}, | ||
"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 chatsky[postgresql]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "4c81bc42", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-09-07T22:34:33.544584Z", | ||
"iopub.status.busy": "2024-09-07T22:34:33.543991Z", | ||
"iopub.status.idle": "2024-09-07T22:34:34.768967Z", | ||
"shell.execute_reply": "2024-09-07T22:34:34.768207Z" | ||
}, | ||
"lines_to_next_cell": 2 | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"\n", | ||
"from chatsky.context_storages import context_storage_factory\n", | ||
"\n", | ||
"from chatsky import Pipeline\n", | ||
"from chatsky.utils.testing.common import (\n", | ||
" check_happy_path,\n", | ||
" is_interactive_mode,\n", | ||
")\n", | ||
"from chatsky.utils.testing.toy_script import TOY_SCRIPT_KWARGS, HAPPY_PATH" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "2d61feff", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-09-07T22:34:34.772287Z", | ||
"iopub.status.busy": "2024-09-07T22:34:34.771613Z", | ||
"iopub.status.idle": "2024-09-07T22:34:34.910597Z", | ||
"shell.execute_reply": "2024-09-07T22:34:34.909927Z" | ||
}, | ||
"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(**TOY_SCRIPT_KWARGS, context_storage=db)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "ae9bc902", | ||
"metadata": { | ||
"execution": { | ||
"iopub.execute_input": "2024-09-07T22:34:34.913869Z", | ||
"iopub.status.busy": "2024-09-07T22:34:34.913376Z", | ||
"iopub.status.idle": "2024-09-07T22:34:34.945947Z", | ||
"shell.execute_reply": "2024-09-07T22:34:34.945346Z" | ||
} | ||
}, | ||
"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, printout=True)\n", | ||
" if is_interactive_mode():\n", | ||
" pipeline.run()" | ||
] | ||
} | ||
], | ||
"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.19" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.