From a2ba8fcfdf13e10d1fa407a758cbe2df425a6234 Mon Sep 17 00:00:00 2001 From: Roman Zlobin Date: Wed, 3 Jul 2024 14:48:42 +0300 Subject: [PATCH] Replace dff with chatsky (#368) --- .github/workflows/update_dashboard.yml | 6 +- CONTRIBUTING.md | 10 +- README.md | 80 +++++------ {dff => chatsky}/__init__.py | 6 +- chatsky/__rebuild_pydantic_models__.py | 9 ++ {dff => chatsky}/config/README.md | 4 +- .../Current_topic_slot_bar_chart_4.yaml | 0 ...Current_topic_time_series_bar_chart_2.yaml | 0 .../charts/Flow_visit_ratio_monitor_13.yaml | 0 .../charts/Node_Visits_7.yaml | 0 .../charts/Node_counts_3.yaml | 0 .../charts/Node_visit_ratio_monitor_8.yaml | 0 .../charts/Node_visits_ratio_6.yaml | 0 .../charts/Node_visits_sunburst_5.yaml | 0 .../charts/Rating_slot_line_chart_1.yaml | 0 .../charts/Requests_17.yaml | 0 .../charts/Responses_16.yaml | 0 .../charts/Service_load_users_9.yaml | 0 .../superset_dashboard/charts/Table_14.yaml | 0 .../charts/Terminal_labels_15.yaml | 0 .../charts/Transition_counts_12.yaml | 0 .../charts/Transition_layout_10.yaml | 0 .../charts/Transition_ratio_chord_11.yaml | 0 .../chatsky_statistics_dashboard_1.yaml | 10 +- .../databases/chatsky_database.yaml | 2 +- .../chatsky_database/chatsky_final_nodes.yaml | 2 +- .../chatsky_database/chatsky_node_stats.yaml | 2 +- .../chatsky_database/chatsky_stats.yaml | 2 +- .../config/superset_dashboard/metadata.yaml | 0 {dff => chatsky}/context_storages/__init__.py | 0 {dff => chatsky}/context_storages/database.py | 4 +- {dff => chatsky}/context_storages/json.py | 4 +- {dff => chatsky}/context_storages/mongo.py | 4 +- {dff => chatsky}/context_storages/pickle.py | 4 +- {dff => chatsky}/context_storages/protocol.py | 8 +- .../context_storages/protocols.json | 0 {dff => chatsky}/context_storages/redis.py | 4 +- {dff => chatsky}/context_storages/shelve.py | 4 +- {dff => chatsky}/context_storages/sql.py | 4 +- {dff => chatsky}/context_storages/ydb.py | 4 +- {dff => chatsky}/messengers/__init__.py | 0 .../messengers/common/__init__.py | 0 .../messengers/common/interface.py | 20 +-- {dff => chatsky}/messengers/common/types.py | 2 +- {dff => chatsky}/messengers/console.py | 10 +- .../messengers/telegram/__init__.py | 0 .../messengers/telegram/abstract.py | 24 ++-- .../messengers/telegram/interface.py | 2 +- {dff => chatsky}/pipeline/__init__.py | 0 {dff => chatsky}/pipeline/conditions.py | 4 +- .../pipeline/pipeline/__init__.py | 0 {dff => chatsky}/pipeline/pipeline/actor.py | 32 ++--- .../pipeline/pipeline/component.py | 8 +- .../pipeline/pipeline/pipeline.py | 44 +++--- {dff => chatsky}/pipeline/pipeline/utils.py | 0 {dff => chatsky}/pipeline/service/__init__.py | 0 {dff => chatsky}/pipeline/service/extra.py | 6 +- {dff => chatsky}/pipeline/service/group.py | 4 +- {dff => chatsky}/pipeline/service/service.py | 6 +- {dff => chatsky}/pipeline/service/utils.py | 2 +- {dff => chatsky}/pipeline/types.py | 16 +-- {dff => chatsky}/script/__init__.py | 0 .../script/conditions/__init__.py | 0 .../script/conditions/std_conditions.py | 6 +- {dff => chatsky}/script/core/__init__.py | 0 {dff => chatsky}/script/core/context.py | 14 +- {dff => chatsky}/script/core/keywords.py | 8 +- {dff => chatsky}/script/core/message.py | 40 +++--- {dff => chatsky}/script/core/normalization.py | 4 +- {dff => chatsky}/script/core/script.py | 6 +- {dff => chatsky}/script/core/types.py | 2 +- {dff => chatsky}/script/extras/__init__.py | 0 .../script/extras/conditions/__init__.py | 0 .../script/extras/slots/__init__.py | 0 {dff => chatsky}/script/labels/__init__.py | 0 {dff => chatsky}/script/labels/std_labels.py | 40 +++--- {dff => chatsky}/script/responses/__init__.py | 0 .../script/responses/std_responses.py | 4 +- chatsky/slots/__init__.py | 7 + {dff => chatsky}/slots/conditions.py | 6 +- {dff => chatsky}/slots/processing.py | 8 +- {dff => chatsky}/slots/response.py | 6 +- {dff => chatsky}/slots/slots.py | 10 +- {dff => chatsky}/stats/__init__.py | 0 {dff => chatsky}/stats/__main__.py | 4 +- {dff => chatsky}/stats/cli.py | 28 ++-- {dff => chatsky}/stats/default_extractors.py | 4 +- {dff => chatsky}/stats/instrumentor.py | 22 +-- {dff => chatsky}/stats/utils.py | 8 +- {dff => chatsky}/utils/__init__.py | 0 chatsky/utils/db_benchmark/__init__.py | 11 ++ .../utils/db_benchmark/basic_config.py | 4 +- .../utils/db_benchmark/benchmark.py | 16 +-- {dff => chatsky}/utils/db_benchmark/report.py | 2 +- {dff => chatsky}/utils/devel/__init__.py | 0 {dff => chatsky}/utils/devel/async_helpers.py | 0 .../utils/devel/extra_field_helpers.py | 0 .../utils/devel/json_serialization.py | 0 chatsky/utils/docker/README.md | 11 ++ .../utils/docker/dockerfile_stats | 0 .../utils/docker/entrypoint_stats.sh | 0 .../utils/docker/superset_config_docker.py | 0 .../utils/otel/otelcol-config-extras.yml | 0 .../utils/otel/otelcol-config.yml | 0 {dff => chatsky}/utils/parser/__init__.py | 0 {dff => chatsky}/utils/testing/__init__.py | 2 +- {dff => chatsky}/utils/testing/cleanup_db.py | 2 +- {dff => chatsky}/utils/testing/common.py | 6 +- .../utils/testing/response_comparers.py | 2 +- {dff => chatsky}/utils/testing/toy_script.py | 6 +- .../utils/turn_caching/__init__.py | 0 .../turn_caching/singleton_turn_caching.py | 0 {dff => chatsky}/utils/viewer/__init__.py | 0 compose.yml | 6 +- dff/__rebuild_pydantic_models__.py | 9 -- dff/slots/__init__.py | 7 - dff/utils/db_benchmark/__init__.py | 11 -- dff/utils/docker/README.md | 11 -- docs/source/_templates/example-links.html | 4 +- docs/source/_templates/source-links.html | 2 +- docs/source/about_us.rst | 2 +- docs/source/community.rst | 16 +-- docs/source/conf.py | 30 ++-- docs/source/development.rst | 12 +- .../{dfe => core}/user_actor.drawio | 0 docs/source/get_started.rst | 42 +++--- docs/source/index.rst | 18 +-- docs/source/tutorials.rst | 12 +- docs/source/user_guides.rst | 8 +- docs/source/user_guides/basic_conceptions.rst | 44 +++--- docs/source/user_guides/context_guide.rst | 38 ++--- .../source/user_guides/optimization_guide.rst | 8 +- docs/source/user_guides/slot_extraction.rst | 34 ++--- docs/source/user_guides/superset_guide.rst | 34 ++--- docs/source/utils/notebook.py | 10 +- poetry.lock | 82 +++++------ pyproject.toml | 22 +-- scripts/codestyle.py | 2 +- scripts/doc.py | 2 +- scripts/misc.py | 2 +- scripts/test.py | 2 +- tests/context_storages/conftest.py | 2 +- tests/context_storages/test_dbs.py | 14 +- .../messengers/telegram/test_happy_paths.json | 132 +++++++++--------- tests/messengers/telegram/test_tutorials.py | 4 +- tests/messengers/telegram/utils.py | 6 +- tests/pipeline/test_messenger_interface.py | 12 +- tests/pipeline/test_parallel_processing.py | 4 +- tests/pipeline/test_pipeline.py | 8 +- tests/pipeline/test_update_ctx_misc.py | 4 +- tests/script/conditions/test_conditions.py | 6 +- tests/script/core/test_actor.py | 8 +- tests/script/core/test_context.py | 2 +- tests/script/core/test_message.py | 12 +- tests/script/core/test_normalization.py | 10 +- tests/script/core/test_script.py | 4 +- tests/script/core/test_validation.py | 6 +- tests/script/labels/test_labels.py | 6 +- tests/script/responses/test_responses.py | 6 +- tests/slots/conftest.py | 8 +- tests/slots/test_slot_manager.py | 4 +- tests/slots/test_slot_types.py | 4 +- tests/slots/test_tutorials.py | 2 +- tests/stats/conftest.py | 4 +- tests/stats/test_defaults.py | 12 +- tests/stats/test_instrumentation.py | 4 +- tests/stats/test_main.py | 24 ++-- tests/stats/test_tutorials.py | 14 +- tests/tutorials/test_format.py | 25 ++-- tests/tutorials/test_tutorials.py | 10 +- tests/tutorials/test_utils.py | 2 +- tests/utils/test_benchmark.py | 10 +- tests/utils/test_serialization.py | 2 +- tutorials/context_storages/1_basics.py | 10 +- tutorials/context_storages/2_postgresql.py | 12 +- tutorials/context_storages/3_mongodb.py | 12 +- tutorials/context_storages/4_redis.py | 12 +- tutorials/context_storages/5_mysql.py | 12 +- tutorials/context_storages/6_sqlite.py | 12 +- .../context_storages/7_yandex_database.py | 12 +- .../context_storages/8_db_benchmarking.py | 10 +- tutorials/messengers/telegram/1_basic.py | 18 +-- .../messengers/telegram/2_attachments.py | 17 ++- tutorials/messengers/telegram/3_advanced.py | 23 ++- .../messengers/web_api_interface/1_fastapi.py | 12 +- .../web_api_interface/2_websocket_chat.py | 10 +- .../3_load_testing_with_locust.py | 8 +- .../web_api_interface/4_streamlit_chat.py | 10 +- tutorials/pipeline/1_basics.py | 12 +- .../pipeline/2_pre_and_post_processors.py | 12 +- .../3_pipeline_dict_with_services_basic.py | 8 +- .../3_pipeline_dict_with_services_full.py | 12 +- .../pipeline/4_groups_and_conditions_basic.py | 8 +- .../pipeline/4_groups_and_conditions_full.py | 8 +- ..._asynchronous_groups_and_services_basic.py | 8 +- ...5_asynchronous_groups_and_services_full.py | 10 +- tutorials/pipeline/6_extra_handlers_basic.py | 15 +- tutorials/pipeline/6_extra_handlers_full.py | 10 +- .../7_extra_handlers_and_extensions.py | 8 +- tutorials/script/core/1_basics.py | 12 +- tutorials/script/core/2_conditions.py | 16 +-- tutorials/script/core/3_responses.py | 14 +- tutorials/script/core/4_transitions.py | 16 +-- tutorials/script/core/5_global_transitions.py | 14 +- .../script/core/6_context_serialization.py | 12 +- .../script/core/7_pre_response_processing.py | 14 +- tutorials/script/core/8_misc.py | 14 +- .../core/9_pre_transitions_processing.py | 14 +- tutorials/script/responses/1_basics.py | 12 +- tutorials/script/responses/2_media.py | 12 +- tutorials/script/responses/3_multi_message.py | 12 +- tutorials/slots/1_basic_example.py | 20 +-- tutorials/stats/1_extractor_functions.py | 22 +-- tutorials/stats/2_pipeline_integration.py | 26 ++-- tutorials/utils/1_cache.py | 14 +- tutorials/utils/2_lru_cache.py | 14 +- utils/db_benchmark/benchmark_dbs.py | 2 +- utils/db_benchmark/benchmark_streamlit.py | 2 +- utils/stats/sample_data_provider.py | 16 +-- .../telegram_tutorial_data.py | 2 +- 220 files changed, 1035 insertions(+), 1029 deletions(-) rename {dff => chatsky}/__init__.py (56%) create mode 100644 chatsky/__rebuild_pydantic_models__.py rename {dff => chatsky}/config/README.md (73%) rename {dff => chatsky}/config/superset_dashboard/charts/Current_topic_slot_bar_chart_4.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Current_topic_time_series_bar_chart_2.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Flow_visit_ratio_monitor_13.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Node_Visits_7.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Node_counts_3.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Node_visit_ratio_monitor_8.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Node_visits_ratio_6.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Node_visits_sunburst_5.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Rating_slot_line_chart_1.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Requests_17.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Responses_16.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Service_load_users_9.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Table_14.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Terminal_labels_15.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Transition_counts_12.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Transition_layout_10.yaml (100%) rename {dff => chatsky}/config/superset_dashboard/charts/Transition_ratio_chord_11.yaml (100%) rename dff/config/superset_dashboard/dashboards/DFF_statistics_dashboard_1.yaml => chatsky/config/superset_dashboard/dashboards/chatsky_statistics_dashboard_1.yaml (99%) rename dff/config/superset_dashboard/databases/dff_database.yaml => chatsky/config/superset_dashboard/databases/chatsky_database.yaml (91%) rename dff/config/superset_dashboard/datasets/dff_database/dff_final_nodes.yaml => chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_final_nodes.yaml (98%) rename dff/config/superset_dashboard/datasets/dff_database/dff_node_stats.yaml => chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_node_stats.yaml (98%) rename dff/config/superset_dashboard/datasets/dff_database/dff_stats.yaml => chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_stats.yaml (99%) rename {dff => chatsky}/config/superset_dashboard/metadata.yaml (100%) rename {dff => chatsky}/context_storages/__init__.py (100%) rename {dff => chatsky}/context_storages/database.py (98%) rename {dff => chatsky}/context_storages/json.py (97%) rename {dff => chatsky}/context_storages/mongo.py (97%) rename {dff => chatsky}/context_storages/pickle.py (96%) rename {dff => chatsky}/context_storages/protocol.py (86%) rename {dff => chatsky}/context_storages/protocols.json (100%) rename {dff => chatsky}/context_storages/redis.py (96%) rename {dff => chatsky}/context_storages/shelve.py (94%) rename {dff => chatsky}/context_storages/sql.py (98%) rename {dff => chatsky}/context_storages/ydb.py (98%) rename {dff => chatsky}/messengers/__init__.py (100%) rename {dff => chatsky}/messengers/common/__init__.py (100%) rename {dff => chatsky}/messengers/common/interface.py (89%) rename {dff => chatsky}/messengers/common/types.py (94%) rename {dff => chatsky}/messengers/console.py (84%) rename {dff => chatsky}/messengers/telegram/__init__.py (100%) rename {dff => chatsky}/messengers/telegram/abstract.py (97%) rename {dff => chatsky}/messengers/telegram/interface.py (97%) rename {dff => chatsky}/pipeline/__init__.py (100%) rename {dff => chatsky}/pipeline/conditions.py (97%) rename {dff => chatsky}/pipeline/pipeline/__init__.py (100%) rename {dff => chatsky}/pipeline/pipeline/actor.py (93%) rename {dff => chatsky}/pipeline/pipeline/component.py (97%) rename {dff => chatsky}/pipeline/pipeline/pipeline.py (91%) rename {dff => chatsky}/pipeline/pipeline/utils.py (100%) rename {dff => chatsky}/pipeline/service/__init__.py (100%) rename {dff => chatsky}/pipeline/service/extra.py (98%) rename {dff => chatsky}/pipeline/service/group.py (99%) rename {dff => chatsky}/pipeline/service/service.py (98%) rename {dff => chatsky}/pipeline/service/utils.py (98%) rename {dff => chatsky}/pipeline/types.py (94%) rename {dff => chatsky}/script/__init__.py (100%) rename {dff => chatsky}/script/conditions/__init__.py (100%) rename {dff => chatsky}/script/conditions/std_conditions.py (98%) rename {dff => chatsky}/script/core/__init__.py (100%) rename {dff => chatsky}/script/core/context.py (96%) rename {dff => chatsky}/script/core/keywords.py (93%) rename {dff => chatsky}/script/core/message.py (87%) rename {dff => chatsky}/script/core/normalization.py (97%) rename {dff => chatsky}/script/core/script.py (98%) rename {dff => chatsky}/script/core/types.py (97%) rename {dff => chatsky}/script/extras/__init__.py (100%) rename {dff => chatsky}/script/extras/conditions/__init__.py (100%) rename {dff => chatsky}/script/extras/slots/__init__.py (100%) rename {dff => chatsky}/script/labels/__init__.py (100%) rename {dff => chatsky}/script/labels/std_labels.py (82%) rename {dff => chatsky}/script/responses/__init__.py (100%) rename {dff => chatsky}/script/responses/std_responses.py (91%) create mode 100644 chatsky/slots/__init__.py rename {dff => chatsky}/slots/conditions.py (87%) rename {dff => chatsky}/slots/processing.py (91%) rename {dff => chatsky}/slots/response.py (88%) rename {dff => chatsky}/slots/slots.py (97%) rename {dff => chatsky}/stats/__init__.py (100%) rename {dff => chatsky}/stats/__main__.py (98%) rename {dff => chatsky}/stats/cli.py (93%) rename {dff => chatsky}/stats/default_extractors.py (96%) rename {dff => chatsky}/stats/instrumentor.py (93%) rename {dff => chatsky}/stats/utils.py (97%) rename {dff => chatsky}/utils/__init__.py (100%) create mode 100644 chatsky/utils/db_benchmark/__init__.py rename {dff => chatsky}/utils/db_benchmark/basic_config.py (98%) rename {dff => chatsky}/utils/db_benchmark/benchmark.py (97%) rename {dff => chatsky}/utils/db_benchmark/report.py (96%) rename {dff => chatsky}/utils/devel/__init__.py (100%) rename {dff => chatsky}/utils/devel/async_helpers.py (100%) rename {dff => chatsky}/utils/devel/extra_field_helpers.py (100%) rename {dff => chatsky}/utils/devel/json_serialization.py (100%) create mode 100644 chatsky/utils/docker/README.md rename {dff => chatsky}/utils/docker/dockerfile_stats (100%) rename {dff => chatsky}/utils/docker/entrypoint_stats.sh (100%) rename {dff => chatsky}/utils/docker/superset_config_docker.py (100%) rename {dff => chatsky}/utils/otel/otelcol-config-extras.yml (100%) rename {dff => chatsky}/utils/otel/otelcol-config.yml (100%) rename {dff => chatsky}/utils/parser/__init__.py (100%) rename {dff => chatsky}/utils/testing/__init__.py (79%) rename {dff => chatsky}/utils/testing/cleanup_db.py (98%) rename {dff => chatsky}/utils/testing/common.py (96%) rename {dff => chatsky}/utils/testing/response_comparers.py (93%) rename {dff => chatsky}/utils/testing/toy_script.py (96%) rename {dff => chatsky}/utils/turn_caching/__init__.py (100%) rename {dff => chatsky}/utils/turn_caching/singleton_turn_caching.py (100%) rename {dff => chatsky}/utils/viewer/__init__.py (100%) delete mode 100644 dff/__rebuild_pydantic_models__.py delete mode 100644 dff/slots/__init__.py delete mode 100644 dff/utils/db_benchmark/__init__.py delete mode 100644 dff/utils/docker/README.md rename docs/source/drawio_src/{dfe => core}/user_actor.drawio (100%) diff --git a/.github/workflows/update_dashboard.yml b/.github/workflows/update_dashboard.yml index 72042885f..34e447967 100644 --- a/.github/workflows/update_dashboard.yml +++ b/.github/workflows/update_dashboard.yml @@ -5,7 +5,7 @@ on: branches: - 'master' paths: - - 'dff/utils/docker/**' + - 'chatsky/utils/docker/**' workflow_dispatch: concurrency: @@ -41,7 +41,7 @@ jobs: - name: Build and upload image uses: docker/build-push-action@v5 with: - context: dff/utils/docker - file: dff/utils/docker/dockerfile_stats + context: chatsky/utils/docker + file: chatsky/utils/docker/dockerfile_stats tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 75347a0dc..80cfe0fe9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,10 @@ ## Introduction We will be glad to receive your pull requests (PRs) and issues for adding new features if you are missing something. -We always look forward to your contributions to the Dialog Flow Framework (DFF). +We always look forward to your contributions to Chatsky. ## Rules for submitting a PR -All PRs are reviewed by DFF developers team. +All PRs are reviewed by Chatsky developers team. In order to make the job of reviewing easier and increase the chance that your PR will be accepted, please add a short description with information about why this PR is needed and what changes will be made. Please use the following rules to write the names of branches and commit messages. @@ -83,11 +83,11 @@ to the local documentation and verified during build. - `%pip install {args}` This directive generates dependency installation cell, adds a comment and sets up "quiet" flag. - It should be used in tutorials, like this: `# %pip install dff[...]`. + It should be used in tutorials, like this: `# %pip install chatsky[...]`. - `%doclink({args})` This directive generates a documentation link. It supports 2 or three arguments and the generated link will look like: `ARG1/ARG2#ARG3`. - The first argument can be either `api` for DFF codebase, `tutorial` for tutorials or `guide` for user guides. + The first argument can be either `api` for Chatsky codebase, `tutorial` for tutorials or `guide` for user guides. - `%mddoclink({args})` This directive is a shortcut for `%doclink` that generates a markdown format link instead. @@ -133,7 +133,7 @@ poetry run poe format Tests are configured via [`.env_file`](.env_file). ### Docker -DFF uses docker images for two purposes: +Chatsky uses docker images for two purposes: 1. Database images for integration testing. 2. Images for statistics collection. diff --git a/README.md b/README.md index 6b54cf43f..1358f08bb 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,35 @@ -# Dialog Flow Framework +# Chatsky -[![Documentation Status](https://github.com/deeppavlov/dialog_flow_framework/workflows/build_and_publish_docs/badge.svg?branch=dev)](https://deeppavlov.github.io/dialog_flow_framework) -[![Codestyle](https://github.com/deeppavlov/dialog_flow_framework/workflows/codestyle/badge.svg?branch=dev)](https://github.com/deeppavlov/dialog_flow_framework/actions/workflows/codestyle.yml) -[![Tests](https://github.com/deeppavlov/dialog_flow_framework/workflows/test_coverage/badge.svg?branch=dev)](https://github.com/deeppavlov/dialog_flow_framework/actions/workflows/test_coverage.yml) -[![License Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/deeppavlov/dialog_flow_framework/blob/master/LICENSE) +[![Documentation Status](https://github.com/deeppavlov/chatsky/workflows/build_and_publish_docs/badge.svg?branch=dev)](https://deeppavlov.github.io/chatsky) +[![Codestyle](https://github.com/deeppavlov/chatsky/workflows/codestyle/badge.svg?branch=dev)](https://github.com/deeppavlov/chatsky/actions/workflows/codestyle.yml) +[![Tests](https://github.com/deeppavlov/chatsky/workflows/test_coverage/badge.svg?branch=dev)](https://github.com/deeppavlov/chatsky/actions/workflows/test_coverage.yml) +[![License Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/deeppavlov/chatsky/blob/master/LICENSE) ![Python 3.8, 3.9, 3.10, 3.11](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-green.svg) -[![PyPI](https://img.shields.io/pypi/v/dff)](https://pypi.org/project/dff/) -[![Downloads](https://pepy.tech/badge/dff)](https://pepy.tech/project/dff) +[![PyPI](https://img.shields.io/pypi/v/chatsky)](https://pypi.org/project/chatsky/) +[![Downloads](https://pepy.tech/badge/chatsky)](https://pepy.tech/project/chatsky) -The Dialog Flow Framework (DFF) allows you to develop conversational services. -DFF offers a specialized domain-specific language (DSL) for quickly writing dialogs in pure Python. The service is created by defining a special dialog graph that determines the behavior of the dialog agent. The latter is then leveraged in the DFF pipeline. +Chatsky allows you to develop conversational services. +Chatsky offers a specialized domain-specific language (DSL) for quickly writing dialogs in pure Python. The service is created by defining a special dialog graph that determines the behavior of the dialog agent. The latter is then leveraged in the Chatsky pipeline. You can use the framework in various services such as social networks, call centers, websites, personal assistants, etc. -DFF, a versatile Python-based conversational service framework, can be deployed across a spectrum of platforms, +Chatsky, a versatile Python-based conversational service framework, can be deployed across a spectrum of platforms, ensuring flexibility for both novice and seasoned developers: -- Cloud platforms like AWS, Azure, and GCP offer scalable environments for DFF, +- Cloud platforms like AWS, Azure, and GCP offer scalable environments for Chatsky, with options such as AWS Lambda and Azure Functions providing serverless execution. -- For containerized deployment, Docker and Kubernetes streamline the orchestration of DFF applications. +- For containerized deployment, Docker and Kubernetes streamline the orchestration of Chatsky applications. - Furthermore, the framework's adaptability extends to IoT ecosystems, making it suitable for integration with edge devices in scenarios like smart homes or industrial automation. Whether deployed on cloud platforms, containerized environments, or directly on IoT devices, -DFF's accessibility and customization options make it a robust choice for developing conversational services +Chatsky's accessibility and customization options make it a robust choice for developing conversational services in the evolving landscape of Python applications and IoT connectivity. -## Why choose DFF +## Why choose Chatsky * Written in pure Python, the framework is easily accessible for both beginners and experienced developers. -* For the same reason, all the abstractions used in DFF can be easily customized and extended using regular language synthax. -* DFF offers easy and straightforward tools for state management which is as easy as setting values of a Python dictionary. +* For the same reason, all the abstractions used in Chatsky can be easily customized and extended using regular language synthax. +* Chatsky offers easy and straightforward tools for state management which is as easy as setting values of a Python dictionary. * The framework is being actively maintained and thoroughly tested. The team is open to suggestions and quickly reacts to bug reports. # Quick Start @@ -44,31 +44,31 @@ in the evolving landscape of Python applications and IoT connectivity. ## Installation -DFF can be installed via pip: +Chatsky can be installed via pip: ```bash -pip install dff +pip install chatsky ``` -The above command will set the minimum dependencies to start working with DFF. +The above command will set the minimum dependencies to start working with Chatsky. The installation process allows the user to choose from different packages based on their dependencies, which are: ```bash -pip install dff[json] # dependencies for using JSON -pip install dff[pickle] # dependencies for using Pickle -pip install dff[redis] # dependencies for using Redis -pip install dff[mongodb] # dependencies for using MongoDB -pip install dff[mysql] # dependencies for using MySQL -pip install dff[postgresql] # dependencies for using PostgreSQL -pip install dff[sqlite] # dependencies for using SQLite -pip install dff[ydb] # dependencies for using Yandex Database -pip install dff[telegram] # dependencies for using Telegram -pip install dff[benchmark] # dependencies for benchmarking +pip install chatsky[json] # dependencies for using JSON +pip install chatsky[pickle] # dependencies for using Pickle +pip install chatsky[redis] # dependencies for using Redis +pip install chatsky[mongodb] # dependencies for using MongoDB +pip install chatsky[mysql] # dependencies for using MySQL +pip install chatsky[postgresql] # dependencies for using PostgreSQL +pip install chatsky[sqlite] # dependencies for using SQLite +pip install chatsky[ydb] # dependencies for using Yandex Database +pip install chatsky[telegram] # dependencies for using Telegram +pip install chatsky[benchmark] # dependencies for benchmarking ``` For example, if you are going to use one of the database backends, you can specify the corresponding requirements yourself. Multiple dependencies can be installed at once, e.g. ```bash -pip install dff[postgresql,mysql] +pip install chatsky[postgresql,mysql] ``` ## Basic example @@ -76,12 +76,12 @@ pip install dff[postgresql,mysql] The following code snippet builds a simplistic chat bot that replies with messages ``Hi!`` and ``OK`` depending on user input, which only takes a few lines of code. All the abstractions used in this example are thoroughly explained in the dedicated -[user guide](https://deeppavlov.github.io/dialog_flow_framework/user_guides/basic_conceptions.html). +[user guide](https://deeppavlov.github.io/chatsky/user_guides/basic_conceptions.html). ```python -from dff.script import GLOBAL, TRANSITIONS, RESPONSE, Message -from dff.pipeline import Pipeline -import dff.script.conditions.std_conditions as cnd +from chatsky.script import GLOBAL, TRANSITIONS, RESPONSE, Message +from chatsky.pipeline import Pipeline +import chatsky.script.conditions.std_conditions as cnd # create a dialog script script = { @@ -129,19 +129,19 @@ Response: OK ``` More advanced examples are available as a part of documentation: -[tutorials](https://deeppavlov.github.io/dialog_flow_framework/tutorials.html). +[tutorials](https://deeppavlov.github.io/chatsky/tutorials.html). ## Further steps -To further explore the API of the framework, you can make use of the [detailed documentation](https://deeppavlov.github.io/dialog_flow_framework/index.html). -Broken down into several sections to highlight all the aspects of development with DFF, +To further explore the API of the framework, you can make use of the [detailed documentation](https://deeppavlov.github.io/chatsky/index.html). +Broken down into several sections to highlight all the aspects of development with Chatsky, the documentation for the library is constantly available online. -# Contributing to the Dialog Flow Framework +# Contributing to Chatsky We are open to accepting pull requests and bug reports. -Please refer to [CONTRIBUTING.md](https://github.com/deeppavlov/dialog_flow_framework/blob/master/CONTRIBUTING.md). +Please refer to [CONTRIBUTING.md](https://github.com/deeppavlov/chatsky/blob/master/CONTRIBUTING.md). # License -DFF is distributed under the terms of the [Apache License 2.0](https://github.com/deeppavlov/dialog_flow_framework/blob/master/LICENSE). +Chatsky is distributed under the terms of the [Apache License 2.0](https://github.com/deeppavlov/chatsky/blob/master/LICENSE). diff --git a/dff/__init__.py b/chatsky/__init__.py similarity index 56% rename from dff/__init__.py rename to chatsky/__init__.py index 37b06376e..539647405 100644 --- a/dff/__init__.py +++ b/chatsky/__init__.py @@ -10,7 +10,7 @@ nest_asyncio.apply() -from dff.pipeline import Pipeline -from dff.script import Context, Script +from chatsky.pipeline import Pipeline +from chatsky.script import Context, Script -import dff.__rebuild_pydantic_models__ +import chatsky.__rebuild_pydantic_models__ diff --git a/chatsky/__rebuild_pydantic_models__.py b/chatsky/__rebuild_pydantic_models__.py new file mode 100644 index 000000000..6d4c5dd92 --- /dev/null +++ b/chatsky/__rebuild_pydantic_models__.py @@ -0,0 +1,9 @@ +# flake8: noqa: F401 + +from chatsky.pipeline import Pipeline +from chatsky.pipeline.types import ExtraHandlerRuntimeInfo +from chatsky.script import Context, Script + +Script.model_rebuild() +Context.model_rebuild() +ExtraHandlerRuntimeInfo.model_rebuild() diff --git a/dff/config/README.md b/chatsky/config/README.md similarity index 73% rename from dff/config/README.md rename to chatsky/config/README.md index f060b14d6..4a4c9f5e0 100644 --- a/dff/config/README.md +++ b/chatsky/config/README.md @@ -5,6 +5,6 @@ This directory provides yaml files for Superset dashboard configuration. The files inside are not supposed to be edited manually for lest of compatibility breaks. Placeholders inside the files will be filled automatically when you use the -`dff.stats` CLI command to generate a configuration archive. +`chatsky.stats` CLI command to generate a configuration archive. -Use `dff.stats -h` for more info. \ No newline at end of file +Use `chatsky.stats -h` for more info. \ No newline at end of file diff --git a/dff/config/superset_dashboard/charts/Current_topic_slot_bar_chart_4.yaml b/chatsky/config/superset_dashboard/charts/Current_topic_slot_bar_chart_4.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Current_topic_slot_bar_chart_4.yaml rename to chatsky/config/superset_dashboard/charts/Current_topic_slot_bar_chart_4.yaml diff --git a/dff/config/superset_dashboard/charts/Current_topic_time_series_bar_chart_2.yaml b/chatsky/config/superset_dashboard/charts/Current_topic_time_series_bar_chart_2.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Current_topic_time_series_bar_chart_2.yaml rename to chatsky/config/superset_dashboard/charts/Current_topic_time_series_bar_chart_2.yaml diff --git a/dff/config/superset_dashboard/charts/Flow_visit_ratio_monitor_13.yaml b/chatsky/config/superset_dashboard/charts/Flow_visit_ratio_monitor_13.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Flow_visit_ratio_monitor_13.yaml rename to chatsky/config/superset_dashboard/charts/Flow_visit_ratio_monitor_13.yaml diff --git a/dff/config/superset_dashboard/charts/Node_Visits_7.yaml b/chatsky/config/superset_dashboard/charts/Node_Visits_7.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Node_Visits_7.yaml rename to chatsky/config/superset_dashboard/charts/Node_Visits_7.yaml diff --git a/dff/config/superset_dashboard/charts/Node_counts_3.yaml b/chatsky/config/superset_dashboard/charts/Node_counts_3.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Node_counts_3.yaml rename to chatsky/config/superset_dashboard/charts/Node_counts_3.yaml diff --git a/dff/config/superset_dashboard/charts/Node_visit_ratio_monitor_8.yaml b/chatsky/config/superset_dashboard/charts/Node_visit_ratio_monitor_8.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Node_visit_ratio_monitor_8.yaml rename to chatsky/config/superset_dashboard/charts/Node_visit_ratio_monitor_8.yaml diff --git a/dff/config/superset_dashboard/charts/Node_visits_ratio_6.yaml b/chatsky/config/superset_dashboard/charts/Node_visits_ratio_6.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Node_visits_ratio_6.yaml rename to chatsky/config/superset_dashboard/charts/Node_visits_ratio_6.yaml diff --git a/dff/config/superset_dashboard/charts/Node_visits_sunburst_5.yaml b/chatsky/config/superset_dashboard/charts/Node_visits_sunburst_5.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Node_visits_sunburst_5.yaml rename to chatsky/config/superset_dashboard/charts/Node_visits_sunburst_5.yaml diff --git a/dff/config/superset_dashboard/charts/Rating_slot_line_chart_1.yaml b/chatsky/config/superset_dashboard/charts/Rating_slot_line_chart_1.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Rating_slot_line_chart_1.yaml rename to chatsky/config/superset_dashboard/charts/Rating_slot_line_chart_1.yaml diff --git a/dff/config/superset_dashboard/charts/Requests_17.yaml b/chatsky/config/superset_dashboard/charts/Requests_17.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Requests_17.yaml rename to chatsky/config/superset_dashboard/charts/Requests_17.yaml diff --git a/dff/config/superset_dashboard/charts/Responses_16.yaml b/chatsky/config/superset_dashboard/charts/Responses_16.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Responses_16.yaml rename to chatsky/config/superset_dashboard/charts/Responses_16.yaml diff --git a/dff/config/superset_dashboard/charts/Service_load_users_9.yaml b/chatsky/config/superset_dashboard/charts/Service_load_users_9.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Service_load_users_9.yaml rename to chatsky/config/superset_dashboard/charts/Service_load_users_9.yaml diff --git a/dff/config/superset_dashboard/charts/Table_14.yaml b/chatsky/config/superset_dashboard/charts/Table_14.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Table_14.yaml rename to chatsky/config/superset_dashboard/charts/Table_14.yaml diff --git a/dff/config/superset_dashboard/charts/Terminal_labels_15.yaml b/chatsky/config/superset_dashboard/charts/Terminal_labels_15.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Terminal_labels_15.yaml rename to chatsky/config/superset_dashboard/charts/Terminal_labels_15.yaml diff --git a/dff/config/superset_dashboard/charts/Transition_counts_12.yaml b/chatsky/config/superset_dashboard/charts/Transition_counts_12.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Transition_counts_12.yaml rename to chatsky/config/superset_dashboard/charts/Transition_counts_12.yaml diff --git a/dff/config/superset_dashboard/charts/Transition_layout_10.yaml b/chatsky/config/superset_dashboard/charts/Transition_layout_10.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Transition_layout_10.yaml rename to chatsky/config/superset_dashboard/charts/Transition_layout_10.yaml diff --git a/dff/config/superset_dashboard/charts/Transition_ratio_chord_11.yaml b/chatsky/config/superset_dashboard/charts/Transition_ratio_chord_11.yaml similarity index 100% rename from dff/config/superset_dashboard/charts/Transition_ratio_chord_11.yaml rename to chatsky/config/superset_dashboard/charts/Transition_ratio_chord_11.yaml diff --git a/dff/config/superset_dashboard/dashboards/DFF_statistics_dashboard_1.yaml b/chatsky/config/superset_dashboard/dashboards/chatsky_statistics_dashboard_1.yaml similarity index 99% rename from dff/config/superset_dashboard/dashboards/DFF_statistics_dashboard_1.yaml rename to chatsky/config/superset_dashboard/dashboards/chatsky_statistics_dashboard_1.yaml index ce8e32496..a32c1c91d 100644 --- a/dff/config/superset_dashboard/dashboards/DFF_statistics_dashboard_1.yaml +++ b/chatsky/config/superset_dashboard/dashboards/chatsky_statistics_dashboard_1.yaml @@ -1,7 +1,7 @@ -dashboard_title: DFF statistics dashboard +dashboard_title: Chatsky statistics dashboard description: null css: '' -slug: dff-stats +slug: chatsky-stats uuid: 68bce374-99bc-4890-b8c2-cb172409b894 position: CHART-91whs_IaiF: @@ -297,7 +297,7 @@ position: HEADER_ID: id: HEADER_ID meta: - text: DFF statistics dashboard + text: Chatsky statistics dashboard type: HEADER MARKDOWN-8Q9BhcEwva: children: [] @@ -378,7 +378,7 @@ position: To make them available in the dashboard, you need to define a custom extractor - function for them (see the [Extractor functions](https://deeppavlov.github.io/dialog_flow_framework/tutorials/tutorials.stats.1_extractor_functions.html) ). + function for them (see the [Extractor functions](https://deeppavlov.github.io/chatsky/tutorials/tutorials.stats.1_extractor_functions.html) ). The output of that function will then be persisted to the `data` column of the logs table, while the name of the function will be available in the `data key` column. That makes it easy to filter the relevant log entries and use @@ -621,7 +621,7 @@ position: ## Service users - This plot aggregates the count of unique users querying the DFF service at + This plot aggregates the count of unique users querying the Chatsky service at any given point in time. The time periods to aggregate over can be changed using the filter on the left. diff --git a/dff/config/superset_dashboard/databases/dff_database.yaml b/chatsky/config/superset_dashboard/databases/chatsky_database.yaml similarity index 91% rename from dff/config/superset_dashboard/databases/dff_database.yaml rename to chatsky/config/superset_dashboard/databases/chatsky_database.yaml index b178a0f80..851fa9d33 100644 --- a/dff/config/superset_dashboard/databases/dff_database.yaml +++ b/chatsky/config/superset_dashboard/databases/chatsky_database.yaml @@ -1,4 +1,4 @@ -database_name: dff_database +database_name: chatsky_database sqlalchemy_uri: clickhousedb+connect://username:XXXXXXXXXX@clickhouse:8123/test cache_timeout: null expose_in_sqllab: true diff --git a/dff/config/superset_dashboard/datasets/dff_database/dff_final_nodes.yaml b/chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_final_nodes.yaml similarity index 98% rename from dff/config/superset_dashboard/datasets/dff_database/dff_final_nodes.yaml rename to chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_final_nodes.yaml index 4a8628298..8cce16f6a 100644 --- a/dff/config/superset_dashboard/datasets/dff_database/dff_final_nodes.yaml +++ b/chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_final_nodes.yaml @@ -1,4 +1,4 @@ -table_name: dff_final_nodes +table_name: chatsky_final_nodes main_dttm_col: null description: null default_endpoint: null diff --git a/dff/config/superset_dashboard/datasets/dff_database/dff_node_stats.yaml b/chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_node_stats.yaml similarity index 98% rename from dff/config/superset_dashboard/datasets/dff_database/dff_node_stats.yaml rename to chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_node_stats.yaml index 4e2cc5792..88196bf50 100644 --- a/dff/config/superset_dashboard/datasets/dff_database/dff_node_stats.yaml +++ b/chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_node_stats.yaml @@ -1,4 +1,4 @@ -table_name: dff_node_stats +table_name: chatsky_node_stats main_dttm_col: null description: null default_endpoint: null diff --git a/dff/config/superset_dashboard/datasets/dff_database/dff_stats.yaml b/chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_stats.yaml similarity index 99% rename from dff/config/superset_dashboard/datasets/dff_database/dff_stats.yaml rename to chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_stats.yaml index 6f1efe683..a33d97261 100644 --- a/dff/config/superset_dashboard/datasets/dff_database/dff_stats.yaml +++ b/chatsky/config/superset_dashboard/datasets/chatsky_database/chatsky_stats.yaml @@ -1,4 +1,4 @@ -table_name: dff_stats +table_name: chatsky_stats main_dttm_col: null description: null default_endpoint: null diff --git a/dff/config/superset_dashboard/metadata.yaml b/chatsky/config/superset_dashboard/metadata.yaml similarity index 100% rename from dff/config/superset_dashboard/metadata.yaml rename to chatsky/config/superset_dashboard/metadata.yaml diff --git a/dff/context_storages/__init__.py b/chatsky/context_storages/__init__.py similarity index 100% rename from dff/context_storages/__init__.py rename to chatsky/context_storages/__init__.py diff --git a/dff/context_storages/database.py b/chatsky/context_storages/database.py similarity index 98% rename from dff/context_storages/database.py rename to chatsky/context_storages/database.py index 0602a0597..3d3a857d1 100644 --- a/dff/context_storages/database.py +++ b/chatsky/context_storages/database.py @@ -21,7 +21,7 @@ class DBContextStorage(ABC): r""" - An abstract interface for `dff` DB context storages. + An abstract interface for `chatsky` DB context storages. It includes the most essential methods of the python `dict` class. Can not be instantiated. @@ -224,5 +224,5 @@ def context_storage_factory(path: str, **kwargs) -> DBContextStorage: For more information, see the function doc:\n{context_storage_factory.__doc__} """ _class, module = PROTOCOLS[prefix]["class"], PROTOCOLS[prefix]["module"] - target_class = getattr(importlib.import_module(f".{module}", package="dff.context_storages"), _class) + target_class = getattr(importlib.import_module(f".{module}", package="chatsky.context_storages"), _class) return target_class(path, **kwargs) diff --git a/dff/context_storages/json.py b/chatsky/context_storages/json.py similarity index 97% rename from dff/context_storages/json.py rename to chatsky/context_storages/json.py index 9c24f2208..9ecc44b63 100644 --- a/dff/context_storages/json.py +++ b/chatsky/context_storages/json.py @@ -2,7 +2,7 @@ JSON ---- The JSON module provides a json-based version of the :py:class:`.DBContextStorage` class. -This class is used to store and retrieve context data in a JSON. It allows the DFF to easily +This class is used to store and retrieve context data in a JSON. It allows Chatsky to easily store and retrieve context data. """ @@ -20,7 +20,7 @@ from pydantic import BaseModel, model_validator from .database import DBContextStorage, threadsafe_method -from dff.script import Context +from chatsky.script import Context class SerializableStorage(BaseModel, extra="allow"): diff --git a/dff/context_storages/mongo.py b/chatsky/context_storages/mongo.py similarity index 97% rename from dff/context_storages/mongo.py rename to chatsky/context_storages/mongo.py index 6789adf8a..166045a12 100644 --- a/dff/context_storages/mongo.py +++ b/chatsky/context_storages/mongo.py @@ -3,7 +3,7 @@ ----- The Mongo module provides a MongoDB-based version of the :py:class:`.DBContextStorage` class. This class is used to store and retrieve context data in a MongoDB. -It allows the DFF to easily store and retrieve context data in a format that is highly scalable +It allows Chatsky to easily store and retrieve context data in a format that is highly scalable and easy to work with. MongoDB is a widely-used, open-source NoSQL database that is known for its scalability and performance. @@ -26,7 +26,7 @@ import json -from dff.script import Context +from chatsky.script import Context from .database import DBContextStorage, threadsafe_method from .protocol import get_protocol_install_suggestion diff --git a/dff/context_storages/pickle.py b/chatsky/context_storages/pickle.py similarity index 96% rename from dff/context_storages/pickle.py rename to chatsky/context_storages/pickle.py index 0fb30e504..9f72a22c3 100644 --- a/dff/context_storages/pickle.py +++ b/chatsky/context_storages/pickle.py @@ -3,7 +3,7 @@ ------ The Pickle module provides a pickle-based version of the :py:class:`.DBContextStorage` class. This class is used to store and retrieve context data in a pickle format. -It allows the DFF to easily store and retrieve context data in a format that is efficient +It allows Chatsky to easily store and retrieve context data in a format that is efficient for serialization and deserialization and can be easily used in python. Pickle is a python library that allows to serialize and deserialize python objects. @@ -24,7 +24,7 @@ pickle_available = False from .database import DBContextStorage, threadsafe_method -from dff.script import Context +from chatsky.script import Context class PickleContextStorage(DBContextStorage): diff --git a/dff/context_storages/protocol.py b/chatsky/context_storages/protocol.py similarity index 86% rename from dff/context_storages/protocol.py rename to chatsky/context_storages/protocol.py index 0d4d54f54..05f04f5b9 100644 --- a/dff/context_storages/protocol.py +++ b/chatsky/context_storages/protocol.py @@ -1,15 +1,15 @@ """ Protocol -------- -The Protocol module contains the base code for the different communication protocols used in the DFF. -It defines the :py:data:`.PROTOCOLS` constant, which lists all the supported protocols in the DFF. +The Protocol module contains the base code for the different communication protocols used in Chatsky. +It defines the :py:data:`.PROTOCOLS` constant, which lists all the supported protocols in Chatsky. The module also includes a function :py:func:`.get_protocol_install_suggestion()` that is used to provide suggestions for installing the necessary dependencies for a specific protocol. This function takes the name of the desired protocol as an argument and returns a string containing the necessary installation commands for that protocol. -The DFF supports a variety of communication protocols, +Chatsky supports a variety of communication protocols, which allows it to communicate with different types of databases. """ @@ -31,5 +31,5 @@ def get_protocol_install_suggestion(protocol_name: str) -> str: protocol = PROTOCOLS.get(protocol_name, {}) slug = protocol.get("slug") if slug: - return f"Try to run `pip install dff[{slug}]`" + return f"Try to run `pip install chatsky[{slug}]`" return "" diff --git a/dff/context_storages/protocols.json b/chatsky/context_storages/protocols.json similarity index 100% rename from dff/context_storages/protocols.json rename to chatsky/context_storages/protocols.json diff --git a/dff/context_storages/redis.py b/chatsky/context_storages/redis.py similarity index 96% rename from dff/context_storages/redis.py rename to chatsky/context_storages/redis.py index 9ef5401a9..7334097c7 100644 --- a/dff/context_storages/redis.py +++ b/chatsky/context_storages/redis.py @@ -3,7 +3,7 @@ ----- The Redis module provides a Redis-based version of the :py:class:`.DBContextStorage` class. This class is used to store and retrieve context data in a Redis. -It allows the DFF to easily store and retrieve context data in a format that is highly scalable +It allows Chatsky to easily store and retrieve context data in a format that is highly scalable and easy to work with. Redis is an open-source, in-memory data structure store that is known for its @@ -23,7 +23,7 @@ except ImportError: redis_available = False -from dff.script import Context +from chatsky.script import Context from .database import DBContextStorage, threadsafe_method from .protocol import get_protocol_install_suggestion diff --git a/dff/context_storages/shelve.py b/chatsky/context_storages/shelve.py similarity index 94% rename from dff/context_storages/shelve.py rename to chatsky/context_storages/shelve.py index fa59dbcc2..de2e97ea5 100644 --- a/dff/context_storages/shelve.py +++ b/chatsky/context_storages/shelve.py @@ -3,7 +3,7 @@ ------ The Shelve module provides a shelve-based version of the :py:class:`.DBContextStorage` class. This class is used to store and retrieve context data in a shelve format. -It allows the DFF to easily store and retrieve context data in a format that is efficient +It allows Chatsky to easily store and retrieve context data in a format that is efficient for serialization and deserialization and can be easily used in python. Shelve is a python library that allows to store and retrieve python objects. @@ -17,7 +17,7 @@ from shelve import DbfilenameShelf from typing import Hashable -from dff.script import Context +from chatsky.script import Context from .database import DBContextStorage diff --git a/dff/context_storages/sql.py b/chatsky/context_storages/sql.py similarity index 98% rename from dff/context_storages/sql.py rename to chatsky/context_storages/sql.py index c43af3356..677c1648d 100644 --- a/dff/context_storages/sql.py +++ b/chatsky/context_storages/sql.py @@ -3,7 +3,7 @@ --- The SQL module provides a SQL-based version of the :py:class:`.DBContextStorage` class. This class is used to store and retrieve context data from SQL databases. -It allows the DFF to easily store and retrieve context data in a format that is highly scalable +It allows Chatsky to easily store and retrieve context data in a format that is highly scalable and easy to work with. The SQL module provides the ability to choose the backend of your choice from @@ -18,7 +18,7 @@ import json from typing import Hashable -from dff.script import Context +from chatsky.script import Context from .database import DBContextStorage, threadsafe_method from .protocol import get_protocol_install_suggestion diff --git a/dff/context_storages/ydb.py b/chatsky/context_storages/ydb.py similarity index 98% rename from dff/context_storages/ydb.py rename to chatsky/context_storages/ydb.py index ed58a3b27..ff50f5b7b 100644 --- a/dff/context_storages/ydb.py +++ b/chatsky/context_storages/ydb.py @@ -6,7 +6,7 @@ operate, and scale high-performance and high-availability databases for your applications. The Yandex DB module uses the Yandex Cloud SDK, which is a python library that allows you to work -with Yandex Cloud services using python. This allows the DFF to easily integrate with the Yandex DataBase and +with Yandex Cloud services using python. This allows Chatsky to easily integrate with the Yandex DataBase and take advantage of the scalability and high-availability features provided by the service. """ @@ -16,7 +16,7 @@ from urllib.parse import urlsplit -from dff.script import Context +from chatsky.script import Context from .database import DBContextStorage from .protocol import get_protocol_install_suggestion diff --git a/dff/messengers/__init__.py b/chatsky/messengers/__init__.py similarity index 100% rename from dff/messengers/__init__.py rename to chatsky/messengers/__init__.py diff --git a/dff/messengers/common/__init__.py b/chatsky/messengers/common/__init__.py similarity index 100% rename from dff/messengers/common/__init__.py rename to chatsky/messengers/common/__init__.py diff --git a/dff/messengers/common/interface.py b/chatsky/messengers/common/interface.py similarity index 89% rename from dff/messengers/common/interface.py rename to chatsky/messengers/common/interface.py index 8037c0408..634fad973 100644 --- a/dff/messengers/common/interface.py +++ b/chatsky/messengers/common/interface.py @@ -2,7 +2,7 @@ Message Interfaces ------------------ The Message Interfaces module contains several basic classes that define the message interfaces. -These classes provide a way to define the structure of the messengers that are used to communicate with the DFF. +These classes provide a way to define the structure of the messengers that are used to communicate with Chatsky. """ from __future__ import annotations @@ -14,10 +14,10 @@ from typing import Optional, Any, List, Tuple, Hashable, TYPE_CHECKING, Type if TYPE_CHECKING: - from dff.script import Context, Message - from dff.pipeline.types import PipelineRunnerFunction - from dff.messengers.common.types import PollingInterfaceLoopFunction - from dff.script.core.message import Attachment + from chatsky.script import Context, Message + from chatsky.pipeline.types import PipelineRunnerFunction + from chatsky.messengers.common.types import PollingInterfaceLoopFunction + from chatsky.script.core.message import Attachment logger = logging.getLogger(__name__) @@ -35,7 +35,7 @@ async def connect(self, pipeline_runner: PipelineRunnerFunction): May be used for sending an introduction message or displaying general bot information. :param pipeline_runner: A function that should process user request and return context; - usually it's a :py:meth:`~dff.pipeline.pipeline.pipeline.Pipeline._run_pipeline` function. + usually it's a :py:meth:`~chatsky.pipeline.pipeline.pipeline.Pipeline._run_pipeline` function. """ raise NotImplementedError @@ -68,7 +68,7 @@ def __init__(self, attachments_directory: Optional[Path] = None) -> None: warning_start = f"Attachments directory for {type(self).__name__} messenger interface" warning_end = "attachment data won't be cached locally!" if attachments_directory is None: - self.attachments_directory = Path(tempdir) / f"dff-cache-{type(self).__name__}" + self.attachments_directory = Path(tempdir) / f"chatsky-cache-{type(self).__name__}" logger.info(f"{warning_start} is None, so will be set to tempdir and {warning_end}") else: self.attachments_directory = attachments_directory @@ -150,7 +150,7 @@ async def connect( for most cases the loop itself shouldn't be overridden. :param pipeline_runner: A function that should process user request and return context; - usually it's a :py:meth:`~dff.pipeline.pipeline.pipeline.Pipeline._run_pipeline` function. + usually it's a :py:meth:`~chatsky.pipeline.pipeline.pipeline.Pipeline._run_pipeline` function. :param loop: a function that determines whether polling should be continued; called in each cycle, should return `True` to continue polling or `False` to stop. :param timeout: a time interval between polls (in seconds). @@ -180,7 +180,7 @@ async def on_request_async( ) -> Context: """ Method that should be invoked on user input. - This method has the same signature as :py:class:`~dff.pipeline.types.PipelineRunnerFunction`. + This method has the same signature as :py:class:`~chatsky.pipeline.types.PipelineRunnerFunction`. """ return await self._pipeline_runner(request, ctx_id, update_ctx_misc) @@ -189,6 +189,6 @@ def on_request( ) -> Context: """ Method that should be invoked on user input. - This method has the same signature as :py:class:`~dff.pipeline.types.PipelineRunnerFunction`. + This method has the same signature as :py:class:`~chatsky.pipeline.types.PipelineRunnerFunction`. """ return asyncio.run(self.on_request_async(request, ctx_id, update_ctx_misc)) diff --git a/dff/messengers/common/types.py b/chatsky/messengers/common/types.py similarity index 94% rename from dff/messengers/common/types.py rename to chatsky/messengers/common/types.py index 516e84331..35696805e 100644 --- a/dff/messengers/common/types.py +++ b/chatsky/messengers/common/types.py @@ -1,7 +1,7 @@ """ Types ----- -The Types module contains special types that are used throughout the `DFF Messengers`. +The Types module contains special types that are used throughout `Chatsky Messengers`. """ from typing import Callable diff --git a/dff/messengers/console.py b/chatsky/messengers/console.py similarity index 84% rename from dff/messengers/console.py rename to chatsky/messengers/console.py index 12d3ee669..a0fe8c690 100644 --- a/dff/messengers/console.py +++ b/chatsky/messengers/console.py @@ -1,9 +1,9 @@ from typing import Any, Hashable, List, Optional, TextIO, Tuple from uuid import uuid4 -from dff.messengers.common.interface import PollingMessengerInterface -from dff.pipeline.types import PipelineRunnerFunction -from dff.script.core.context import Context -from dff.script.core.message import Message +from chatsky.messengers.common.interface import PollingMessengerInterface +from chatsky.pipeline.types import PipelineRunnerFunction +from chatsky.script.core.context import Context +from chatsky.script.core.message import Message class CLIMessengerInterface(PollingMessengerInterface): @@ -40,7 +40,7 @@ async def connect(self, pipeline_runner: PipelineRunnerFunction, **kwargs): The CLIProvider generates new dialog id used to user identification on each `connect` call. :param pipeline_runner: A function that should process user request and return context; - usually it's a :py:meth:`~dff.pipeline.pipeline.pipeline.Pipeline._run_pipeline` function. + usually it's a :py:meth:`~chatsky.pipeline.pipeline.pipeline.Pipeline._run_pipeline` function. :param \\**kwargs: argument, added for compatibility with super class, it shouldn't be used normally. """ self._ctx_id = uuid4() diff --git a/dff/messengers/telegram/__init__.py b/chatsky/messengers/telegram/__init__.py similarity index 100% rename from dff/messengers/telegram/__init__.py rename to chatsky/messengers/telegram/__init__.py diff --git a/dff/messengers/telegram/abstract.py b/chatsky/messengers/telegram/abstract.py similarity index 97% rename from dff/messengers/telegram/abstract.py rename to chatsky/messengers/telegram/abstract.py index e0e192d4e..30742579d 100644 --- a/dff/messengers/telegram/abstract.py +++ b/chatsky/messengers/telegram/abstract.py @@ -8,11 +8,11 @@ from pathlib import Path from typing import Any, Callable, Optional -from dff.utils.devel.extra_field_helpers import grab_extra_fields +from chatsky.utils.devel.extra_field_helpers import grab_extra_fields -from dff.messengers.common import MessengerInterfaceWithAttachments -from dff.pipeline.types import PipelineRunnerFunction -from dff.script.core.message import ( +from chatsky.messengers.common import MessengerInterfaceWithAttachments +from chatsky.pipeline.types import PipelineRunnerFunction +from chatsky.script.core.message import ( Animation, Audio, CallbackQuery, @@ -90,7 +90,7 @@ class _AbstractTelegramInterface(MessengerInterfaceWithAttachments): def __init__(self, token: str, attachments_directory: Optional[Path] = None) -> None: super().__init__(attachments_directory) if not telegram_available: - raise ImportError("`python-telegram-bot` package is missing.\nTry to run `pip install dff[telegram]`.") + raise ImportError("`python-telegram-bot` package is missing.\nTry to run `pip install chatsky[telegram]`.") self.application = Application.builder().token(token).build() self.application.add_handler(MessageHandler(ALL, self.on_message)) @@ -103,11 +103,11 @@ async def get_attachment_bytes(self, source: str) -> bytes: def extract_message_from_telegram(self, update: TelegramMessage) -> Message: """ - Convert Telegram update to DFF message. + Convert Telegram update to Chatsky message. Extract text and supported attachments. :param update: Telegram update object. - :return: DFF message object. + :return: Chatsky message object. """ message = Message() @@ -261,7 +261,7 @@ def extract_message_from_telegram(self, update: TelegramMessage) -> Message: async def cast_message_to_telegram_and_send(self, bot: ExtBot, chat_id: int, message: Message) -> None: """ - Send DFF message to Telegram. + Send Chatsky message to Telegram. Sometimes, if several attachments included into message can not be sent as one update, several Telegram updates will be produced. Sometimes, if no text and none of the supported attachments are included, @@ -269,7 +269,7 @@ async def cast_message_to_telegram_and_send(self, bot: ExtBot, chat_id: int, mes :param bot: Telegram bot, that is used for connection to Telegram API. :param chat_id: Telegram dialog ID that the message will be sent to. - :param message: DFF message that will be processed into Telegram updates. + :param message: Chatsky message that will be processed into Telegram updates. """ if message.text is not None: @@ -621,7 +621,7 @@ async def _on_event(self, update: Update, _: Any, create_message: Callable[[Upda Process Telegram update, run pipeline and send response to Telegram. :param update: Telegram update that will be processed. - :param create_message: function that converts Telegram update to DFF message. + :param create_message: function that converts Telegram update to Chatsky message. """ data_available = update.message is not None or update.callback_query is not None @@ -636,7 +636,7 @@ async def _on_event(self, update: Update, _: Any, create_message: Callable[[Upda async def on_message(self, update: Update, _: Any) -> None: """ - Process normal Telegram update, extracting DFF message from it + Process normal Telegram update, extracting Chatsky message from it using :py:meth:`~._AbstractTelegramInterface.extract_message_from_telegram`. :param update: Telegram update that will be processed. @@ -646,7 +646,7 @@ async def on_message(self, update: Update, _: Any) -> None: async def on_callback(self, update: Update, _: Any) -> None: """ - Process Telegram callback update, creating empty DFF message + Process Telegram callback update, creating empty Chatsky message with only one callback query attachment from `callback_query.data` field. :param update: Telegram update that will be processed. diff --git a/dff/messengers/telegram/interface.py b/chatsky/messengers/telegram/interface.py similarity index 97% rename from dff/messengers/telegram/interface.py rename to chatsky/messengers/telegram/interface.py index bcfabb0c1..5015fbf2f 100644 --- a/dff/messengers/telegram/interface.py +++ b/chatsky/messengers/telegram/interface.py @@ -8,7 +8,7 @@ from pathlib import Path from typing import Any, Optional -from dff.pipeline.types import PipelineRunnerFunction +from chatsky.pipeline.types import PipelineRunnerFunction from .abstract import _AbstractTelegramInterface diff --git a/dff/pipeline/__init__.py b/chatsky/pipeline/__init__.py similarity index 100% rename from dff/pipeline/__init__.py rename to chatsky/pipeline/__init__.py diff --git a/dff/pipeline/conditions.py b/chatsky/pipeline/conditions.py similarity index 97% rename from dff/pipeline/conditions.py rename to chatsky/pipeline/conditions.py index 3fd14dde6..01a5acb45 100644 --- a/dff/pipeline/conditions.py +++ b/chatsky/pipeline/conditions.py @@ -9,7 +9,7 @@ from __future__ import annotations from typing import Optional, TYPE_CHECKING -from dff.script import Context +from chatsky.script import Context from .types import ( StartConditionCheckerFunction, @@ -18,7 +18,7 @@ ) if TYPE_CHECKING: - from dff.pipeline.pipeline.pipeline import Pipeline + from chatsky.pipeline.pipeline.pipeline import Pipeline def always_start_condition(_: Context, __: Pipeline) -> bool: diff --git a/dff/pipeline/pipeline/__init__.py b/chatsky/pipeline/pipeline/__init__.py similarity index 100% rename from dff/pipeline/pipeline/__init__.py rename to chatsky/pipeline/pipeline/__init__.py diff --git a/dff/pipeline/pipeline/actor.py b/chatsky/pipeline/pipeline/actor.py similarity index 93% rename from dff/pipeline/pipeline/actor.py rename to chatsky/pipeline/pipeline/actor.py index 33a3d2daa..87e627e6b 100644 --- a/dff/pipeline/pipeline/actor.py +++ b/chatsky/pipeline/pipeline/actor.py @@ -29,41 +29,41 @@ from typing import Union, Callable, Optional, Dict, List, TYPE_CHECKING import copy -from dff.utils.turn_caching import cache_clear -from dff.script.core.types import ActorStage, NodeLabel2Type, NodeLabel3Type, LabelType -from dff.script.core.message import Message +from chatsky.utils.turn_caching import cache_clear +from chatsky.script.core.types import ActorStage, NodeLabel2Type, NodeLabel3Type, LabelType +from chatsky.script.core.message import Message -from dff.script.core.context import Context -from dff.script.core.script import Script, Node -from dff.script.core.normalization import normalize_label, normalize_response -from dff.script.core.keywords import GLOBAL, LOCAL -from dff.utils.devel.async_helpers import wrap_sync_function_in_async +from chatsky.script.core.context import Context +from chatsky.script.core.script import Script, Node +from chatsky.script.core.normalization import normalize_label, normalize_response +from chatsky.script.core.keywords import GLOBAL, LOCAL +from chatsky.utils.devel.async_helpers import wrap_sync_function_in_async logger = logging.getLogger(__name__) if TYPE_CHECKING: - from dff.pipeline.pipeline.pipeline import Pipeline + from chatsky.pipeline.pipeline.pipeline import Pipeline class Actor: """ - The class which is used to process :py:class:`~dff.script.Context` - according to the :py:class:`~dff.script.Script`. + The class which is used to process :py:class:`~chatsky.script.Context` + according to the :py:class:`~chatsky.script.Script`. :param script: The dialog scenario: a graph described by the :py:class:`.Keywords`. While the graph is being initialized, it is validated and then used for the dialog. - :param start_label: The start node of :py:class:`~dff.script.Script`. The execution begins with it. - :param fallback_label: The label of :py:class:`~dff.script.Script`. + :param start_label: The start node of :py:class:`~chatsky.script.Script`. The execution begins with it. + :param fallback_label: The label of :py:class:`~chatsky.script.Script`. Dialog comes into that label if all other transitions failed, or there was an error while executing the scenario. Defaults to `None`. - :param label_priority: Default priority value for all :py:const:`labels ` + :param label_priority: Default priority value for all :py:const:`labels ` where there is no priority. Defaults to `1.0`. :param condition_handler: Handler that processes a call of condition functions. Defaults to `None`. :param handlers: This variable is responsible for the usage of external handlers on - the certain stages of work of :py:class:`~dff.script.Actor`. + the certain stages of work of :py:class:`~chatsky.script.Actor`. - - key (:py:class:`~dff.script.ActorStage`) - Stage in which the handler is called. + - key (:py:class:`~chatsky.script.ActorStage`) - Stage in which the handler is called. - value (List[Callable]) - The list of called handlers for each stage. Defaults to an empty `dict`. """ diff --git a/dff/pipeline/pipeline/component.py b/chatsky/pipeline/pipeline/component.py similarity index 97% rename from dff/pipeline/pipeline/component.py rename to chatsky/pipeline/pipeline/component.py index 7384578b7..ab37426ea 100644 --- a/dff/pipeline/pipeline/component.py +++ b/chatsky/pipeline/pipeline/component.py @@ -15,7 +15,7 @@ import asyncio from typing import Optional, Awaitable, TYPE_CHECKING -from dff.script import Context +from chatsky.script import Context from ..service.extra import BeforeHandler, AfterHandler from ..conditions import always_start_condition @@ -32,7 +32,7 @@ logger = logging.getLogger(__name__) if TYPE_CHECKING: - from dff.pipeline.pipeline.pipeline import Pipeline + from chatsky.pipeline.pipeline.pipeline import Pipeline class PipelineComponent(abc.ABC): @@ -93,7 +93,7 @@ def __init__( self.path = path """ Dot-separated path to component (is universally unique). - This attribute is set in :py:func:`~dff.pipeline.pipeline.utils.finalize_service_group`. + This attribute is set in :py:func:`~chatsky.pipeline.pipeline.utils.finalize_service_group`. """ self.before_handler = BeforeHandler([] if before_handler is None else before_handler) @@ -204,7 +204,7 @@ def _get_runtime_info(self, ctx: Context) -> ServiceRuntimeInfo: Method for retrieving runtime info about this component. :param ctx: Current dialog :py:class:`~.Context`. - :return: :py:class:`~.dff.script.typing.ServiceRuntimeInfo` + :return: :py:class:`~.chatsky.script.typing.ServiceRuntimeInfo` object where all not set fields are replaced with `[None]`. """ return ServiceRuntimeInfo( diff --git a/dff/pipeline/pipeline/pipeline.py b/chatsky/pipeline/pipeline/pipeline.py similarity index 91% rename from dff/pipeline/pipeline/pipeline.py rename to chatsky/pipeline/pipeline/pipeline.py index b036c2dc0..92d62f684 100644 --- a/dff/pipeline/pipeline/pipeline.py +++ b/chatsky/pipeline/pipeline/pipeline.py @@ -2,7 +2,7 @@ Pipeline -------- The Pipeline module contains the :py:class:`.Pipeline` class, -which is a fundamental element of the DFF. The Pipeline class is responsible +which is a fundamental element of Chatsky. The Pipeline class is responsible for managing and executing the various components (:py:class:`.PipelineComponent`)which make up the processing of messages from and to users. It provides a way to organize and structure the messages processing flow. @@ -18,14 +18,14 @@ import logging from typing import Union, List, Dict, Optional, Hashable, Callable -from dff.context_storages import DBContextStorage -from dff.script import Script, Context, ActorStage -from dff.script import NodeLabel2Type, Message -from dff.utils.turn_caching import cache_clear +from chatsky.context_storages import DBContextStorage +from chatsky.script import Script, Context, ActorStage +from chatsky.script import NodeLabel2Type, Message +from chatsky.utils.turn_caching import cache_clear -from dff.messengers.console import CLIMessengerInterface -from dff.messengers.common import MessengerInterface -from dff.slots.slots import GroupSlot +from chatsky.messengers.console import CLIMessengerInterface +from chatsky.messengers.common import MessengerInterface +from chatsky.slots.slots import GroupSlot from ..service.group import ServiceGroup from ..types import ( ServiceBuilder, @@ -36,7 +36,7 @@ ExtraHandlerBuilder, ) from .utils import finalize_service_group, pretty_format_component_info_dict -from dff.pipeline.pipeline.actor import Actor +from chatsky.pipeline.pipeline.actor import Actor logger = logging.getLogger(__name__) @@ -54,14 +54,14 @@ class Pipeline: :param script: (required) A :py:class:`~.Script` instance (object or dict). :param start_label: (required) Actor start label. :param fallback_label: Actor fallback label. - :param label_priority: Default priority value for all actor :py:const:`labels ` + :param label_priority: Default priority value for all actor :py:const:`labels ` where there is no priority. Defaults to `1.0`. :param condition_handler: Handler that processes a call of actor condition functions. Defaults to `None`. :param slots: Slots configuration. :param handlers: This variable is responsible for the usage of external handlers on - the certain stages of work of :py:class:`~dff.script.Actor`. + the certain stages of work of :py:class:`~chatsky.script.Actor`. - - key: :py:class:`~dff.script.ActorStage` - Stage in which the handler is called. + - key: :py:class:`~chatsky.script.ActorStage` - Stage in which the handler is called. - value: List[Callable] - The list of called handlers for each stage. Defaults to an empty `dict`. :param messenger_interface: An `AbsMessagingInterface` instance for this pipeline. @@ -231,7 +231,7 @@ def from_script( :param script: (required) A :py:class:`~.Script` instance (object or dict). :param start_label: (required) Actor start label. :param fallback_label: Actor fallback label. - :param label_priority: Default priority value for all actor :py:const:`labels ` + :param label_priority: Default priority value for all actor :py:const:`labels ` where there is no priority. Defaults to `1.0`. :param condition_handler: Handler that processes a call of actor condition functions. Defaults to `None`. :param slots: Slots configuration. @@ -239,9 +239,9 @@ def from_script( defined in the ``PRE_RESPONSE_PROCESSING`` and ``PRE_TRANSITIONS_PROCESSING`` sections of the script should be parallelized over respective groups. :param handlers: This variable is responsible for the usage of external handlers on - the certain stages of work of :py:class:`~dff.script.Actor`. + the certain stages of work of :py:class:`~chatsky.script.Actor`. - - key: :py:class:`~dff.script.ActorStage` - Stage in which the handler is called. + - key: :py:class:`~chatsky.script.ActorStage` - Stage in which the handler is called. - value: List[Callable] - The list of called handlers for each stage. Defaults to an empty `dict`. :param context_storage: An :py:class:`~.DBContextStorage` instance for this pipeline @@ -286,17 +286,17 @@ def set_actor( :param script: (required) A :py:class:`~.Script` instance (object or dict). :param start_label: (required) Actor start label. - The start node of :py:class:`~dff.script.Script`. The execution begins with it. - :param fallback_label: Actor fallback label. The label of :py:class:`~dff.script.Script`. + The start node of :py:class:`~chatsky.script.Script`. The execution begins with it. + :param fallback_label: Actor fallback label. The label of :py:class:`~chatsky.script.Script`. Dialog comes into that label if all other transitions failed, or there was an error while executing the scenario. - :param label_priority: Default priority value for all actor :py:const:`labels ` + :param label_priority: Default priority value for all actor :py:const:`labels ` where there is no priority. Defaults to `1.0`. :param condition_handler: Handler that processes a call of actor condition functions. Defaults to `None`. :param handlers: This variable is responsible for the usage of external handlers on - the certain stages of work of :py:class:`~dff.script.Actor`. + the certain stages of work of :py:class:`~chatsky.script.Actor`. - - key :py:class:`~dff.script.ActorStage` - Stage in which the handler is called. + - key :py:class:`~chatsky.script.ActorStage` - Stage in which the handler is called. - value List[Callable] - The list of called handlers for each stage. Defaults to an empty `dict`. """ self.actor = Actor(script, start_label, fallback_label, label_priority, condition_handler, handlers) @@ -315,7 +315,7 @@ async def _run_pipeline( ) -> Context: """ Method that should be invoked on user input. - This method has the same signature as :py:class:`~dff.pipeline.types.PipelineRunnerFunction`. + This method has the same signature as :py:class:`~chatsky.pipeline.types.PipelineRunnerFunction`. """ if ctx_id is None: ctx = Context() @@ -365,7 +365,7 @@ def __call__( Basically, it is a shortcut for `_run_pipeline`. NB! When pipeline is executed this way, `messenger_interface` won't be initiated nor connected. - This method has the same signature as :py:class:`~dff.pipeline.types.PipelineRunnerFunction`. + This method has the same signature as :py:class:`~chatsky.pipeline.types.PipelineRunnerFunction`. """ return asyncio.run(self._run_pipeline(request, ctx_id, update_ctx_misc)) diff --git a/dff/pipeline/pipeline/utils.py b/chatsky/pipeline/pipeline/utils.py similarity index 100% rename from dff/pipeline/pipeline/utils.py rename to chatsky/pipeline/pipeline/utils.py diff --git a/dff/pipeline/service/__init__.py b/chatsky/pipeline/service/__init__.py similarity index 100% rename from dff/pipeline/service/__init__.py rename to chatsky/pipeline/service/__init__.py diff --git a/dff/pipeline/service/extra.py b/chatsky/pipeline/service/extra.py similarity index 98% rename from dff/pipeline/service/extra.py rename to chatsky/pipeline/service/extra.py index f9194ec4f..8a8a65a9b 100644 --- a/dff/pipeline/service/extra.py +++ b/chatsky/pipeline/service/extra.py @@ -12,10 +12,10 @@ import inspect from typing import Optional, List, TYPE_CHECKING -from dff.script import Context +from chatsky.script import Context from .utils import collect_defined_constructor_parameters_to_dict, _get_attrs_with_updates -from dff.utils.devel.async_helpers import wrap_sync_function_in_async +from chatsky.utils.devel.async_helpers import wrap_sync_function_in_async from ..types import ( ServiceRuntimeInfo, ExtraHandlerType, @@ -27,7 +27,7 @@ logger = logging.getLogger(__name__) if TYPE_CHECKING: - from dff.pipeline.pipeline.pipeline import Pipeline + from chatsky.pipeline.pipeline.pipeline import Pipeline class _ComponentExtraHandler: diff --git a/dff/pipeline/service/group.py b/chatsky/pipeline/service/group.py similarity index 99% rename from dff/pipeline/service/group.py rename to chatsky/pipeline/service/group.py index 13e412663..22b8bae0d 100644 --- a/dff/pipeline/service/group.py +++ b/chatsky/pipeline/service/group.py @@ -13,7 +13,7 @@ import logging from typing import Optional, List, Union, Awaitable, TYPE_CHECKING -from dff.script import Context +from chatsky.script import Context from .utils import collect_defined_constructor_parameters_to_dict, _get_attrs_with_updates from ..pipeline.component import PipelineComponent @@ -32,7 +32,7 @@ logger = logging.getLogger(__name__) if TYPE_CHECKING: - from dff.pipeline.pipeline.pipeline import Pipeline + from chatsky.pipeline.pipeline.pipeline import Pipeline class ServiceGroup(PipelineComponent): diff --git a/dff/pipeline/service/service.py b/chatsky/pipeline/service/service.py similarity index 98% rename from dff/pipeline/service/service.py rename to chatsky/pipeline/service/service.py index 9eae76468..fdf43f0bb 100644 --- a/dff/pipeline/service/service.py +++ b/chatsky/pipeline/service/service.py @@ -15,10 +15,10 @@ import inspect from typing import Optional, TYPE_CHECKING -from dff.script import Context +from chatsky.script import Context from .utils import collect_defined_constructor_parameters_to_dict, _get_attrs_with_updates -from dff.utils.devel.async_helpers import wrap_sync_function_in_async +from chatsky.utils.devel.async_helpers import wrap_sync_function_in_async from ..types import ( ServiceBuilder, StartConditionCheckerFunction, @@ -31,7 +31,7 @@ logger = logging.getLogger(__name__) if TYPE_CHECKING: - from dff.pipeline.pipeline.pipeline import Pipeline + from chatsky.pipeline.pipeline.pipeline import Pipeline class Service(PipelineComponent): diff --git a/dff/pipeline/service/utils.py b/chatsky/pipeline/service/utils.py similarity index 98% rename from dff/pipeline/service/utils.py rename to chatsky/pipeline/service/utils.py index 06d168ad2..651f89b92 100644 --- a/dff/pipeline/service/utils.py +++ b/chatsky/pipeline/service/utils.py @@ -1,7 +1,7 @@ """ Utility Functions ----------------- -The Utility Functions module contains several utility functions that are commonly used throughout the DFF. +The Utility Functions module contains several utility functions that are commonly used throughout Chatsky. These functions provide a variety of utility functionality. """ diff --git a/dff/pipeline/types.py b/chatsky/pipeline/types.py similarity index 94% rename from dff/pipeline/types.py rename to chatsky/pipeline/types.py index aafec8393..118532559 100644 --- a/dff/pipeline/types.py +++ b/chatsky/pipeline/types.py @@ -1,7 +1,7 @@ """ Types ----- -The Types module contains several classes and special types that are used throughout the `DFF Pipeline`. +The Types module contains several classes and special types that are used throughout `Chatsky Pipeline`. The classes and special types in this module can include data models, data structures, and other types that are defined for type hinting. """ @@ -14,13 +14,13 @@ if TYPE_CHECKING: - from dff.pipeline.pipeline.pipeline import Pipeline - from dff.pipeline.service.service import Service - from dff.pipeline.service.group import ServiceGroup - from dff.pipeline.service.extra import _ComponentExtraHandler - from dff.messengers.common.interface import MessengerInterface - from dff.context_storages import DBContextStorage - from dff.script import Context, ActorStage, NodeLabel2Type, Script, Message + from chatsky.pipeline.pipeline.pipeline import Pipeline + from chatsky.pipeline.service.service import Service + from chatsky.pipeline.service.group import ServiceGroup + from chatsky.pipeline.service.extra import _ComponentExtraHandler + from chatsky.messengers.common.interface import MessengerInterface + from chatsky.context_storages import DBContextStorage + from chatsky.script import Context, ActorStage, NodeLabel2Type, Script, Message class PipelineRunnerFunction(Protocol): diff --git a/dff/script/__init__.py b/chatsky/script/__init__.py similarity index 100% rename from dff/script/__init__.py rename to chatsky/script/__init__.py diff --git a/dff/script/conditions/__init__.py b/chatsky/script/conditions/__init__.py similarity index 100% rename from dff/script/conditions/__init__.py rename to chatsky/script/conditions/__init__.py diff --git a/dff/script/conditions/std_conditions.py b/chatsky/script/conditions/std_conditions.py similarity index 98% rename from dff/script/conditions/std_conditions.py rename to chatsky/script/conditions/std_conditions.py index 8568a98ce..7a5479f9a 100644 --- a/dff/script/conditions/std_conditions.py +++ b/chatsky/script/conditions/std_conditions.py @@ -15,9 +15,9 @@ from pydantic import validate_call -from dff.pipeline import Pipeline -from dff.script import NodeLabel2Type, Context, Message -from dff.script.core.message import CallbackQuery +from chatsky.pipeline import Pipeline +from chatsky.script import NodeLabel2Type, Context, Message +from chatsky.script.core.message import CallbackQuery logger = logging.getLogger(__name__) diff --git a/dff/script/core/__init__.py b/chatsky/script/core/__init__.py similarity index 100% rename from dff/script/core/__init__.py rename to chatsky/script/core/__init__.py diff --git a/dff/script/core/context.py b/chatsky/script/core/context.py similarity index 96% rename from dff/script/core/context.py rename to chatsky/script/core/context.py index c84e5eee4..30c589a96 100644 --- a/dff/script/core/context.py +++ b/chatsky/script/core/context.py @@ -24,13 +24,13 @@ from pydantic import BaseModel, Field, field_validator -from dff.script.core.message import Message -from dff.script.core.types import NodeLabel2Type -from dff.pipeline.types import ComponentExecutionState -from dff.slots.slots import SlotManager +from chatsky.script.core.message import Message +from chatsky.script.core.types import NodeLabel2Type +from chatsky.pipeline.types import ComponentExecutionState +from chatsky.slots.slots import SlotManager if TYPE_CHECKING: - from dff.script.core.script import Node + from chatsky.script.core.script import Node logger = logging.getLogger(__name__) @@ -98,7 +98,7 @@ class Context(BaseModel): misc: Dict[str, Any] = Field(default_factory=dict) """ `misc` stores any custom data. The scripting doesn't use this dictionary by default, - so storage of any data won't reflect on the work on the internal Dialog Flow Scripting functions. + so storage of any data won't reflect on the work on the internal Chatsky Scripting functions. Avoid storing unserializable data in order for context storages to work. @@ -263,7 +263,7 @@ def last_request(self, request: Optional[Message]): @property def current_node(self) -> Optional[Node]: """ - Return current :py:class:`~dff.script.core.script.Node`. + Return current :py:class:`~chatsky.script.core.script.Node`. """ actor_data = self.framework_data.actor_data node = ( diff --git a/dff/script/core/keywords.py b/chatsky/script/core/keywords.py similarity index 93% rename from dff/script/core/keywords.py rename to chatsky/script/core/keywords.py index 761b71a32..c2ff5baec 100644 --- a/dff/script/core/keywords.py +++ b/chatsky/script/core/keywords.py @@ -11,7 +11,7 @@ class Keywords(str, Enum): """ - Keywords used to define the dialog script (:py:class:`~dff.script.Script`). + Keywords used to define the dialog script (:py:class:`~chatsky.script.Script`). The data type `dict` is used to describe the scenario. `Enums` of this class are used as keys in this `dict`. Different keys correspond to the different value types aimed at different purposes. @@ -23,7 +23,7 @@ class Keywords(str, Enum): The value that corresponds to this key has the `dict` type with keywords: `{TRANSITIONS:..., RESPONSE:..., PRE_RESPONSE_PROCESSING:..., MISC:...}`. - There can be only one global node in a script :py:class:`~dff.script.Script`. + There can be only one global node in a script :py:class:`~chatsky.script.Script`. The global node is defined at the flow level as opposed to regular nodes. This node allows to define default global values for all nodes. @@ -65,7 +65,7 @@ class Keywords(str, Enum): `{"PRE_RESPONSE_PROC_0": pre_response_proc_func_0, ..., "PRE_RESPONSE_PROC_N": pre_response_proc__func_N}`, where `"PRE_RESPONSE_PROC_i"` is an arbitrary name of the preprocessing stage in the pipeline. - Unless the :py:class:`~dff.pipeline.pipeline.Pipeline`'s `parallelize_processing` flag + Unless the :py:class:`~chatsky.pipeline.pipeline.Pipeline`'s `parallelize_processing` flag is set to `True`, calls to `pre_response_proc__func_i` are made in-order. PRE_TRANSITIONS_PROCESSING: Enum(auto) @@ -76,7 +76,7 @@ class Keywords(str, Enum): "PRE_TRANSITIONS_PROC_N": pre_transitions_proc_func_N}`, where `"PRE_TRANSITIONS_PROC_i"` is an arbitrary name of the preprocessing stage in the pipeline. - Unless the :py:class:`~dff.pipeline.pipeline.Pipeline`'s `parallelize_processing` flag + Unless the :py:class:`~chatsky.pipeline.pipeline.Pipeline`'s `parallelize_processing` flag is set to `True`, calls to `pre_transitions_proc_func_i` are made in-order. """ diff --git a/dff/script/core/message.py b/chatsky/script/core/message.py similarity index 87% rename from dff/script/core/message.py rename to chatsky/script/core/message.py index 6fdf18977..79120598c 100644 --- a/dff/script/core/message.py +++ b/chatsky/script/core/message.py @@ -2,7 +2,7 @@ Message ------- The :py:class:`.Message` class is a universal data model for representing a message that should be supported by -DFF. It only contains types and properties that are compatible with most messaging services. +Chatsky. It only contains types and properties that are compatible with most messaging services. """ from typing import Literal, Optional, List, Union @@ -14,8 +14,8 @@ from pydantic import Field, FilePath, HttpUrl, model_validator from pydantic_core import Url -from dff.messengers.common.interface import MessengerInterfaceWithAttachments -from dff.utils.devel import JSONSerializableDict, PickleEncodedValue, JSONSerializableExtras +from chatsky.messengers.common.interface import MessengerInterfaceWithAttachments +from chatsky.utils.devel import JSONSerializableDict, PickleEncodedValue, JSONSerializableExtras class DataModel(JSONSerializableExtras): @@ -28,11 +28,11 @@ class DataModel(JSONSerializableExtras): class Attachment(DataModel, abc.ABC): """ - DFF Message attachment base class. + Chatsky Message attachment base class. It is capable of serializing and validating all the model fields to JSON. """ - dff_attachment_type: str + chatsky_attachment_type: str class CallbackQuery(Attachment): @@ -43,7 +43,7 @@ class CallbackQuery(Attachment): """ query_string: Optional[str] - dff_attachment_type: Literal["callback_query"] = "callback_query" + chatsky_attachment_type: Literal["callback_query"] = "callback_query" class Location(Attachment): @@ -57,7 +57,7 @@ class Location(Attachment): longitude: float latitude: float - dff_attachment_type: Literal["location"] = "location" + chatsky_attachment_type: Literal["location"] = "location" class Contact(Attachment): @@ -69,7 +69,7 @@ class Contact(Attachment): phone_number: str first_name: str last_name: Optional[str] - dff_attachment_type: Literal["contact"] = "contact" + chatsky_attachment_type: Literal["contact"] = "contact" class Invoice(Attachment): @@ -82,7 +82,7 @@ class Invoice(Attachment): description: str currency: str amount: int - dff_attachment_type: Literal["invoice"] = "invoice" + chatsky_attachment_type: Literal["invoice"] = "invoice" class PollOption(DataModel): @@ -93,7 +93,7 @@ class PollOption(DataModel): text: str votes: int = Field(default=0) - dff_attachment_type: Literal["poll_option"] = "poll_option" + chatsky_attachment_type: Literal["poll_option"] = "poll_option" class Poll(Attachment): @@ -104,7 +104,7 @@ class Poll(Attachment): question: str options: List[PollOption] - dff_attachment_type: Literal["poll"] = "poll" + chatsky_attachment_type: Literal["poll"] = "poll" class DataAttachment(Attachment): @@ -187,49 +187,49 @@ def validate_source_or_id(cls, values: dict): class Audio(DataAttachment): """Represents an audio file attachment.""" - dff_attachment_type: Literal["audio"] = "audio" + chatsky_attachment_type: Literal["audio"] = "audio" class Video(DataAttachment): """Represents a video file attachment.""" - dff_attachment_type: Literal["video"] = "video" + chatsky_attachment_type: Literal["video"] = "video" class Animation(DataAttachment): """Represents an animation file attachment.""" - dff_attachment_type: Literal["animation"] = "animation" + chatsky_attachment_type: Literal["animation"] = "animation" class Image(DataAttachment): """Represents an image file attachment.""" - dff_attachment_type: Literal["image"] = "image" + chatsky_attachment_type: Literal["image"] = "image" class Sticker(DataAttachment): """Represents a sticker as a file attachment.""" - dff_attachment_type: Literal["sticker"] = "sticker" + chatsky_attachment_type: Literal["sticker"] = "sticker" class Document(DataAttachment): """Represents a document file attachment.""" - dff_attachment_type: Literal["document"] = "document" + chatsky_attachment_type: Literal["document"] = "document" class VoiceMessage(DataAttachment): """Represents a voice message.""" - dff_attachment_type: Literal["voice_message"] = "voice_message" + chatsky_attachment_type: Literal["voice_message"] = "voice_message" class VideoMessage(DataAttachment): """Represents a video message.""" - dff_attachment_type: Literal["video_message"] = "video_message" + chatsky_attachment_type: Literal["video_message"] = "video_message" class MediaGroup(Attachment): @@ -243,7 +243,7 @@ class MediaGroup(Attachment): """ group: List[Union[Audio, Video, Image, Document, DataAttachment]] = Field(default_factory=list) - dff_attachment_type: Literal["media_group"] = "media_group" + chatsky_attachment_type: Literal["media_group"] = "media_group" class Message(DataModel): diff --git a/dff/script/core/normalization.py b/chatsky/script/core/normalization.py similarity index 97% rename from dff/script/core/normalization.py rename to chatsky/script/core/normalization.py index 2784b2647..39b7dde8c 100644 --- a/dff/script/core/normalization.py +++ b/chatsky/script/core/normalization.py @@ -16,7 +16,7 @@ from .message import Message if TYPE_CHECKING: - from dff.pipeline.pipeline.pipeline import Pipeline + from chatsky.pipeline.pipeline.pipeline import Pipeline logger = logging.getLogger(__name__) @@ -24,7 +24,7 @@ def normalize_label(label: Label, default_flow_label: LabelType = "") -> Label: """ The function that is used for normalization of - :py:const:`label `. + :py:const:`label `. :param label: If label is Callable the function is wrapped into try/except and normalization is used on the result of the function call with the name label. diff --git a/dff/script/core/script.py b/chatsky/script/core/script.py similarity index 98% rename from dff/script/core/script.py rename to chatsky/script/core/script.py index 3c7fde9b5..985d6d30f 100644 --- a/dff/script/core/script.py +++ b/chatsky/script/core/script.py @@ -21,8 +21,8 @@ from .normalization import normalize_condition, normalize_label if TYPE_CHECKING: - from dff.script.core.context import Context - from dff.pipeline.pipeline.pipeline import Pipeline + from chatsky.script.core.context import Context + from chatsky.pipeline.pipeline.pipeline import Pipeline logger = logging.getLogger(__name__) @@ -64,7 +64,7 @@ def _types_equal(signature_type: Any, expected_type: str) -> bool: def _validate_callable(callable: Callable, func_type: UserFunctionType, flow_label: str, node_label: str) -> List: """ - This function validates a function during :py:class:`~dff.script.Script` validation. + This function validates a function during :py:class:`~chatsky.script.Script` validation. It checks parameter number (unconditionally), parameter types (if specified) and return type (if specified). :param callable: Function to validate. diff --git a/dff/script/core/types.py b/chatsky/script/core/types.py similarity index 97% rename from dff/script/core/types.py rename to chatsky/script/core/types.py index 413159174..8655c96ad 100644 --- a/dff/script/core/types.py +++ b/chatsky/script/core/types.py @@ -14,7 +14,7 @@ from .keywords import Keywords LabelType: TypeAlias = Union[str, Keywords] -"""Label can be a casual string or :py:class:`~dff.script.Keywords`.""" +"""Label can be a casual string or :py:class:`~chatsky.script.Keywords`.""" # todo: rename these to identifiers NodeLabel1Type: TypeAlias = Tuple[str, float] diff --git a/dff/script/extras/__init__.py b/chatsky/script/extras/__init__.py similarity index 100% rename from dff/script/extras/__init__.py rename to chatsky/script/extras/__init__.py diff --git a/dff/script/extras/conditions/__init__.py b/chatsky/script/extras/conditions/__init__.py similarity index 100% rename from dff/script/extras/conditions/__init__.py rename to chatsky/script/extras/conditions/__init__.py diff --git a/dff/script/extras/slots/__init__.py b/chatsky/script/extras/slots/__init__.py similarity index 100% rename from dff/script/extras/slots/__init__.py rename to chatsky/script/extras/slots/__init__.py diff --git a/dff/script/labels/__init__.py b/chatsky/script/labels/__init__.py similarity index 100% rename from dff/script/labels/__init__.py rename to chatsky/script/labels/__init__.py diff --git a/dff/script/labels/std_labels.py b/chatsky/script/labels/std_labels.py similarity index 82% rename from dff/script/labels/std_labels.py rename to chatsky/script/labels/std_labels.py index 6f58c4411..a52aa37fc 100644 --- a/dff/script/labels/std_labels.py +++ b/chatsky/script/labels/std_labels.py @@ -1,28 +1,28 @@ """ Labels ------ -:py:const:`Labels ` are one of the important components of the dialog graph, +:py:const:`Labels ` are one of the important components of the dialog graph, which determine the targeted node name of the transition. They are used to identify the next step in the conversation. Labels can also be used in combination with other conditions, such as the current context or user data, to create more complex and dynamic conversations. -This module contains a standard set of scripting :py:const:`labels ` that +This module contains a standard set of scripting :py:const:`labels ` that can be used by developers to define the conversation flow. """ from __future__ import annotations from typing import Optional, Callable, TYPE_CHECKING -from dff.script import Context, ConstLabel +from chatsky.script import Context, ConstLabel if TYPE_CHECKING: - from dff.pipeline.pipeline.pipeline import Pipeline + from chatsky.pipeline.pipeline.pipeline import Pipeline def repeat(priority: Optional[float] = None) -> Callable[[Context, Pipeline], ConstLabel]: """ Returns transition handler that takes :py:class:`.Context`, - :py:class:`~dff.pipeline.Pipeline` and :py:const:`priority `. + :py:class:`~chatsky.pipeline.Pipeline` and :py:const:`priority `. This handler returns a :py:const:`label ` to the last node with a given :py:const:`priority `. If the priority is not given, `Pipeline.actor.label_priority` is used as default. @@ -43,9 +43,9 @@ def repeat_transition_handler(ctx: Context, pipeline: Pipeline) -> ConstLabel: def previous(priority: Optional[float] = None) -> Callable[[Context, Pipeline], ConstLabel]: """ - Returns transition handler that takes :py:class:`~dff.script.Context`, - :py:class:`~dff.pipeline.Pipeline` and :py:const:`priority `. - This handler returns a :py:const:`label ` + Returns transition handler that takes :py:class:`~chatsky.script.Context`, + :py:class:`~chatsky.pipeline.Pipeline` and :py:const:`priority `. + This handler returns a :py:const:`label ` to the previous node with a given :py:const:`priority `. If the priority is not given, `Pipeline.actor.label_priority` is used as default. If the current node is the start node, fallback is returned. @@ -68,9 +68,9 @@ def previous_transition_handler(ctx: Context, pipeline: Pipeline) -> ConstLabel: def to_start(priority: Optional[float] = None) -> Callable[[Context, Pipeline], ConstLabel]: """ - Returns transition handler that takes :py:class:`~dff.script.Context`, - :py:class:`~dff.pipeline.Pipeline` and :py:const:`priority `. - This handler returns a :py:const:`label ` + Returns transition handler that takes :py:class:`~chatsky.script.Context`, + :py:class:`~chatsky.pipeline.Pipeline` and :py:const:`priority `. + This handler returns a :py:const:`label ` to the start node with a given :py:const:`priority `. If the priority is not given, `Pipeline.actor.label_priority` is used as default. @@ -86,9 +86,9 @@ def to_start_transition_handler(ctx: Context, pipeline: Pipeline) -> ConstLabel: def to_fallback(priority: Optional[float] = None) -> Callable[[Context, Pipeline], ConstLabel]: """ - Returns transition handler that takes :py:class:`~dff.script.Context`, - :py:class:`~dff.pipeline.Pipeline` and :py:const:`priority `. - This handler returns a :py:const:`label ` + Returns transition handler that takes :py:class:`~chatsky.script.Context`, + :py:class:`~chatsky.pipeline.Pipeline` and :py:const:`priority `. + This handler returns a :py:const:`label ` to the fallback node with a given :py:const:`priority `. If the priority is not given, `Pipeline.actor.label_priority` is used as default. @@ -141,9 +141,9 @@ def forward( priority: Optional[float] = None, cyclicality_flag: bool = True ) -> Callable[[Context, Pipeline], ConstLabel]: """ - Returns transition handler that takes :py:class:`~dff.script.Context`, - :py:class:`~dff.pipeline.Pipeline` and :py:const:`priority `. - This handler returns a :py:const:`label ` + Returns transition handler that takes :py:class:`~chatsky.script.Context`, + :py:class:`~chatsky.pipeline.Pipeline` and :py:const:`priority `. + This handler returns a :py:const:`label ` to the forward node with a given :py:const:`priority ` and :py:const:`cyclicality_flag `. If the priority is not given, `Pipeline.actor.label_priority` is used as default. @@ -164,9 +164,9 @@ def backward( priority: Optional[float] = None, cyclicality_flag: bool = True ) -> Callable[[Context, Pipeline], ConstLabel]: """ - Returns transition handler that takes :py:class:`~dff.script.Context`, - :py:class:`~dff.pipeline.Pipeline` and :py:const:`priority `. - This handler returns a :py:const:`label ` + Returns transition handler that takes :py:class:`~chatsky.script.Context`, + :py:class:`~chatsky.pipeline.Pipeline` and :py:const:`priority `. + This handler returns a :py:const:`label ` to the backward node with a given :py:const:`priority ` and :py:const:`cyclicality_flag `. If the priority is not given, `Pipeline.actor.label_priority` is used as default. diff --git a/dff/script/responses/__init__.py b/chatsky/script/responses/__init__.py similarity index 100% rename from dff/script/responses/__init__.py rename to chatsky/script/responses/__init__.py diff --git a/dff/script/responses/std_responses.py b/chatsky/script/responses/std_responses.py similarity index 91% rename from dff/script/responses/std_responses.py rename to chatsky/script/responses/std_responses.py index b80fbe46c..060b6e264 100644 --- a/dff/script/responses/std_responses.py +++ b/chatsky/script/responses/std_responses.py @@ -12,8 +12,8 @@ import random from typing import List -from dff.pipeline import Pipeline -from dff.script import Context, Message +from chatsky.pipeline import Pipeline +from chatsky.script import Context, Message def choice(responses: List[Message]): diff --git a/chatsky/slots/__init__.py b/chatsky/slots/__init__.py new file mode 100644 index 000000000..c0a22623c --- /dev/null +++ b/chatsky/slots/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# flake8: noqa: F401 + +from chatsky.slots.slots import GroupSlot, ValueSlot, RegexpSlot, FunctionSlot +from chatsky.slots.conditions import slots_extracted +from chatsky.slots.processing import extract, extract_all, unset, unset_all, fill_template +from chatsky.slots.response import filled_template diff --git a/dff/slots/conditions.py b/chatsky/slots/conditions.py similarity index 87% rename from dff/slots/conditions.py rename to chatsky/slots/conditions.py index 80ebdf222..d2e3f9d33 100644 --- a/dff/slots/conditions.py +++ b/chatsky/slots/conditions.py @@ -8,9 +8,9 @@ from typing import TYPE_CHECKING, Literal if TYPE_CHECKING: - from dff.script import Context - from dff.slots.slots import SlotName - from dff.pipeline import Pipeline + from chatsky.script import Context + from chatsky.slots.slots import SlotName + from chatsky.pipeline import Pipeline def slots_extracted(*slots: SlotName, mode: Literal["any", "all"] = "all"): diff --git a/dff/slots/processing.py b/chatsky/slots/processing.py similarity index 91% rename from dff/slots/processing.py rename to chatsky/slots/processing.py index 1f99c4c23..df3df43f9 100644 --- a/dff/slots/processing.py +++ b/chatsky/slots/processing.py @@ -1,7 +1,7 @@ """ Processing --------------------------- -This module provides wrappers for :py:class:`~dff.slots.slots.SlotManager`'s API. +This module provides wrappers for :py:class:`~chatsky.slots.slots.SlotManager`'s API. """ from __future__ import annotations @@ -10,9 +10,9 @@ from typing import Awaitable, Callable, TYPE_CHECKING if TYPE_CHECKING: - from dff.slots.slots import SlotName - from dff.script import Context - from dff.pipeline import Pipeline + from chatsky.slots.slots import SlotName + from chatsky.script import Context + from chatsky.pipeline import Pipeline logger = logging.getLogger(__name__) diff --git a/dff/slots/response.py b/chatsky/slots/response.py similarity index 88% rename from dff/slots/response.py rename to chatsky/slots/response.py index 152b79ddb..473960704 100644 --- a/dff/slots/response.py +++ b/chatsky/slots/response.py @@ -1,15 +1,15 @@ """ Response --------------------------- -Slot-related DFF responses. +Slot-related Chatsky responses. """ from __future__ import annotations from typing import Callable, TYPE_CHECKING if TYPE_CHECKING: - from dff.script import Context, Message - from dff.pipeline import Pipeline + from chatsky.script import Context, Message + from chatsky.pipeline import Pipeline def filled_template(template: Message) -> Callable[[Context, Pipeline], Message]: diff --git a/dff/slots/slots.py b/chatsky/slots/slots.py similarity index 97% rename from dff/slots/slots.py rename to chatsky/slots/slots.py index 536501751..29dc44b9a 100644 --- a/dff/slots/slots.py +++ b/chatsky/slots/slots.py @@ -16,12 +16,12 @@ from pydantic import BaseModel, model_validator, Field -from dff.utils.devel.async_helpers import wrap_sync_function_in_async -from dff.utils.devel.json_serialization import PickleEncodedValue +from chatsky.utils.devel.async_helpers import wrap_sync_function_in_async +from chatsky.utils.devel.json_serialization import PickleEncodedValue if TYPE_CHECKING: - from dff.script import Context, Message - from dff.pipeline.pipeline.pipeline import Pipeline + from chatsky.script import Context, Message + from chatsky.pipeline.pipeline.pipeline import Pipeline logger = logging.getLogger(__name__) @@ -88,7 +88,7 @@ class ExtractedSlot(BaseModel, ABC): Represents value of an extracted slot. Instances of this class are managed by framework and - are stored in :py:attr:`~dff.script.core.context.FrameworkData.slot_manager`. + are stored in :py:attr:`~chatsky.script.core.context.FrameworkData.slot_manager`. They can be accessed via the ``ctx.framework_data.slot_manager.get_extracted_slot`` method. """ diff --git a/dff/stats/__init__.py b/chatsky/stats/__init__.py similarity index 100% rename from dff/stats/__init__.py rename to chatsky/stats/__init__.py diff --git a/dff/stats/__main__.py b/chatsky/stats/__main__.py similarity index 98% rename from dff/stats/__main__.py rename to chatsky/stats/__main__.py index 0b1b206cf..e22220119 100644 --- a/dff/stats/__main__.py +++ b/chatsky/stats/__main__.py @@ -13,7 +13,7 @@ # Create and import a configuration archive. # The import overrides existing dashboard configurations. - dff.stats config.yaml \\ + chatsky.stats config.yaml \\ -U superset_user \\ -P superset_password \\ -dP database_password \\ @@ -47,7 +47,7 @@ def main(parsed_args: Optional[argparse.Namespace] = None): The function accepts a yaml file; also, all of the options can also be overridden via the command line. Setting passwords interactively is supported. - dff.stats config.yaml \\ + chatsky.stats config.yaml \\ -U superset_user \\ -P superset_password \\ -dP database_password \\ diff --git a/dff/stats/cli.py b/chatsky/stats/cli.py similarity index 93% rename from dff/stats/cli.py rename to chatsky/stats/cli.py index 3d862a96e..ede565cb6 100644 --- a/dff/stats/cli.py +++ b/chatsky/stats/cli.py @@ -20,26 +20,26 @@ from omegaconf import OmegaConf from .utils import get_superset_session, drop_superset_assets except ImportError: - raise ImportError("Some packages are not found. Run `pip install dff[stats]`") + raise ImportError("Some packages are not found. Run `pip install chatsky[stats]`") logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) -DFF_DIR = Path(__file__).absolute().parent.parent +CHATSKY_DIR = Path(__file__).absolute().parent.parent """ -Root directory of the local `dff` installation. +Root directory of the local `chatsky` installation. :meta hide-value: """ -DASHBOARD_DIR = str(DFF_DIR / "config" / "superset_dashboard") +DASHBOARD_DIR = str(CHATSKY_DIR / "config" / "superset_dashboard") """ Local path to superset dashboard files to import. :meta hide-value: """ -DASHBOARD_SLUG = "dff-stats" +DASHBOARD_SLUG = "chatsky-stats" """ -This variable stores a slug used for building the http address of the DFF dashboard. +This variable stores a slug used for building the http address of the Chatsky dashboard. """ DEFAULT_SUPERSET_URL = parse.urlunsplit(("http", "localhost:8088", "/", "", "")) """ @@ -59,7 +59,7 @@ :meta hide-value: """ -DFF_NODE_STATS_STATEMENT = """ +CHATSKY_NODE_STATS_STATEMENT = """ WITH main AS ( SELECT DISTINCT {table}.LogAttributes['context_id'] as context_id, toUInt64OrNull({table}.LogAttributes['request_id']) as request_id, @@ -85,7 +85,7 @@ node_label FROM main """ -DFF_STATS_STATEMENT = """ +CHATSKY_STATS_STATEMENT = """ WITH main AS ( SELECT DISTINCT {table}.LogAttributes['context_id'] as context_id, toUInt64OrNull({table}.LogAttributes['request_id']) as request_id, @@ -111,7 +111,7 @@ node_label FROM main """ -DFF_FINAL_NODES_STATEMENT = """ +CHATSKY_FINAL_NODES_STATEMENT = """ WITH main AS ( SELECT LogAttributes['context_id'] AS context_id, max(toUInt64OrNull(LogAttributes['request_id'])) AS max_history @@ -133,9 +133,9 @@ """ SQL_STATEMENT_MAPPING = { - "dff_stats.yaml": DFF_STATS_STATEMENT, - "dff_node_stats.yaml": DFF_NODE_STATS_STATEMENT, - "dff_final_nodes.yaml": DFF_FINAL_NODES_STATEMENT, + "chatsky_stats.yaml": CHATSKY_STATS_STATEMENT, + "chatsky_node_stats.yaml": CHATSKY_NODE_STATS_STATEMENT, + "chatsky_final_nodes.yaml": CHATSKY_FINAL_NODES_STATEMENT, } """ Select statements for dashboard configuration with names and types represented as placeholders. @@ -171,7 +171,7 @@ def import_dashboard(parsed_args: Optional[argparse.Namespace] = None, zip_file: import_dashboard_url, headers=headers, data={ - "passwords": '{"databases/dff_database.yaml":"' + db_password + '"}', + "passwords": '{"databases/chatsky_database.yaml":"' + db_password + '"}', "overwrite": "true", }, files=[("formData", (zip_filename, f, "application/zip"))], @@ -236,7 +236,7 @@ def make_zip_config(parsed_args: argparse.Namespace) -> Path: shutil.copytree(DASHBOARD_DIR, nested_temp_dir) database_dir = Path(os.path.join(nested_temp_dir, "databases")) - dataset_dir = Path(os.path.join(nested_temp_dir, "datasets/dff_database")) + dataset_dir = Path(os.path.join(nested_temp_dir, "datasets/chatsky_database")) logger.info("Overriding the initial configuration.") # overwrite sqlalchemy uri diff --git a/dff/stats/default_extractors.py b/chatsky/stats/default_extractors.py similarity index 96% rename from dff/stats/default_extractors.py rename to chatsky/stats/default_extractors.py index 9b3856e2a..e390148f5 100644 --- a/dff/stats/default_extractors.py +++ b/chatsky/stats/default_extractors.py @@ -13,8 +13,8 @@ from datetime import datetime -from dff.script import Context -from dff.pipeline import ExtraHandlerRuntimeInfo, Pipeline +from chatsky.script import Context +from chatsky.pipeline import ExtraHandlerRuntimeInfo, Pipeline from .utils import get_extra_handler_name diff --git a/dff/stats/instrumentor.py b/chatsky/stats/instrumentor.py similarity index 93% rename from dff/stats/instrumentor.py rename to chatsky/stats/instrumentor.py index 30f7cd20f..a395c7b4c 100644 --- a/dff/stats/instrumentor.py +++ b/chatsky/stats/instrumentor.py @@ -3,7 +3,7 @@ ------------- This modules contains the :py:class:`~OtelInstrumentor` class that implements Opentelemetry's `BaseInstrumentor` interface and allows for automated -instrumentation of Dialog Flow Framework applications, +instrumentation of Chatsky applications, e.g. for automated logging and log export. For detailed reference, see `~OtelInstrumentor` class. @@ -26,23 +26,23 @@ from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter from opentelemetry.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter -from dff.script.core.context import get_last_index -from dff.stats.utils import ( +from chatsky.script.core.context import get_last_index +from chatsky.stats.utils import ( resource, get_extra_handler_name, set_logger_destination, set_meter_destination, set_tracer_destination, ) -from dff.stats import default_extractors +from chatsky.stats import default_extractors -INSTRUMENTS = ["dff"] +INSTRUMENTS = ["chatsky"] class OtelInstrumentor(BaseInstrumentor): """ - Utility class for instrumenting DFF-related functions + Utility class for instrumenting Chatsky-related functions that implements the :py:class:`~BaseInstrumentor` interface. :py:meth:`~instrument` and :py:meth:`~uninstrument` methods are available to apply and revert the instrumentation effects, @@ -50,9 +50,9 @@ class OtelInstrumentor(BaseInstrumentor): .. code-block:: - dff_instrumentor = OtelInstrumentor() - dff_instrumentor.instrument() - dff_instrumentor.uninstrument() + chatsky_instrumentor = OtelInstrumentor() + chatsky_instrumentor.instrument() + chatsky_instrumentor.uninstrument() Opentelemetry provider instances can be optionally passed to the class constructor. Otherwise, the global logger, tracer and meter providers are leveraged. @@ -62,7 +62,7 @@ class OtelInstrumentor(BaseInstrumentor): .. code-block:: - @dff_instrumentor + @chatsky_instrumentor async def function(context, pipeline, runtime_info): ... @@ -145,7 +145,7 @@ def _configure_providers(self, logger_provider, tracer_provider, meter_provider) @decorator async def __call__(self, wrapped, _, args, kwargs): """ - Regular functions that match the :py:class:`~dff.pipeline.types.ExtraHandlerFunction` + Regular functions that match the :py:class:`~chatsky.pipeline.types.ExtraHandlerFunction` signature can be decorated with the class instance to log the returned value. This method implements the logging procedure. The returned value is assumed to be `dict` or `NoneType`. diff --git a/dff/stats/utils.py b/chatsky/stats/utils.py similarity index 97% rename from dff/stats/utils.py rename to chatsky/stats/utils.py index 7e2152ccd..51ac9ad4d 100644 --- a/dff/stats/utils.py +++ b/chatsky/stats/utils.py @@ -33,9 +33,9 @@ from opentelemetry.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter, LogExporter from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter, MetricExporter -from dff.pipeline import ExtraHandlerRuntimeInfo +from chatsky.pipeline import ExtraHandlerRuntimeInfo -SERVICE_NAME = "dialog_flow_framework" +SERVICE_NAME = "chatsky" resource = Resource.create({"service.name": SERVICE_NAME}) """ @@ -43,11 +43,11 @@ """ tracer_provider = TracerProvider(resource=resource) """ -Global tracer provider bound to the DFF resource. +Global tracer provider bound to the Chatsky resource. """ logger_provider = LoggerProvider(resource=resource) """ -Global logger provider bound to the DFF resource. +Global logger provider bound to the Chatsky resource. """ set_logger_provider(logger_provider) set_tracer_provider(tracer_provider) diff --git a/dff/utils/__init__.py b/chatsky/utils/__init__.py similarity index 100% rename from dff/utils/__init__.py rename to chatsky/utils/__init__.py diff --git a/chatsky/utils/db_benchmark/__init__.py b/chatsky/utils/db_benchmark/__init__.py new file mode 100644 index 000000000..9b464f464 --- /dev/null +++ b/chatsky/utils/db_benchmark/__init__.py @@ -0,0 +1,11 @@ +# -*- coding: utf-8 -*- +from chatsky.utils.db_benchmark.benchmark import ( + time_context_read_write, + DBFactory, + BenchmarkConfig, + BenchmarkCase, + save_results_to_file, + benchmark_all, +) +from chatsky.utils.db_benchmark.report import report +from chatsky.utils.db_benchmark.basic_config import BasicBenchmarkConfig, basic_configurations diff --git a/dff/utils/db_benchmark/basic_config.py b/chatsky/utils/db_benchmark/basic_config.py similarity index 98% rename from dff/utils/db_benchmark/basic_config.py rename to chatsky/utils/db_benchmark/basic_config.py index f4d590c35..11e744dd0 100644 --- a/dff/utils/db_benchmark/basic_config.py +++ b/chatsky/utils/db_benchmark/basic_config.py @@ -15,8 +15,8 @@ from humanize import naturalsize from pympler import asizeof -from dff.script import Message, Context -from dff.utils.db_benchmark.benchmark import BenchmarkConfig +from chatsky.script import Message, Context +from chatsky.utils.db_benchmark.benchmark import BenchmarkConfig def get_dict(dimensions: Tuple[int, ...]): diff --git a/dff/utils/db_benchmark/benchmark.py b/chatsky/utils/db_benchmark/benchmark.py similarity index 97% rename from dff/utils/db_benchmark/benchmark.py rename to chatsky/utils/db_benchmark/benchmark.py index 8e1eab523..f1132d283 100644 --- a/dff/utils/db_benchmark/benchmark.py +++ b/chatsky/utils/db_benchmark/benchmark.py @@ -12,10 +12,10 @@ Wrappers use :py:class:`~.BenchmarkConfig` interface to configure benchmarks. A simple configuration class as well as a configuration set are provided by -:py:mod:`dff.utils.db_benchmark.basic_config`. +:py:mod:`chatsky.utils.db_benchmark.basic_config`. To view files generated by :py:func:`~.save_results_to_file` use either -:py:func:`~dff.utils.db_benchmark.report.report` or +:py:func:`~chatsky.utils.db_benchmark.report.report` or `our streamlit app <../_misc/benchmark_streamlit.py>`_. """ @@ -32,8 +32,8 @@ from pydantic import BaseModel, Field from tqdm.auto import tqdm -from dff.context_storages import DBContextStorage -from dff.script import Context +from chatsky.context_storages import DBContextStorage +from chatsky.script import Context def time_context_read_write( @@ -60,7 +60,7 @@ def time_context_read_write( (to emulate context updating during dialog). The function should return `None` to stop updating contexts. For an example of such function, see implementation of - :py:meth:`dff.utils.db_benchmark.basic_config.BasicBenchmarkConfig.context_updater`. + :py:meth:`chatsky.utils.db_benchmark.basic_config.BasicBenchmarkConfig.context_updater`. To avoid keeping many contexts in memory, this function will be called repeatedly at least `context_num` times. @@ -134,7 +134,7 @@ class DBFactory(BaseModel): uri: str """URI of the context storage.""" - factory_module: str = "dff.context_storages" + factory_module: str = "chatsky.context_storages" """A module containing `factory`.""" factory: str = "context_storage_factory" """Name of the context storage factory. (function that creates context storages from URIs)""" @@ -155,7 +155,7 @@ class BenchmarkConfig(BaseModel, abc.ABC, frozen=True): Also defines a method (`info`) for displaying information about this configuration. A simple way to configure benchmarks is provided by - :py:class:`~.dff.utils.db_benchmark.basic_config.BasicBenchmarkConfig`. + :py:class:`~.chatsky.utils.db_benchmark.basic_config.BasicBenchmarkConfig`. Inherit from this class only if `BasicBenchmarkConfig` is not enough for your benchmarking needs. """ @@ -344,7 +344,7 @@ def save_results_to_file( Result are saved in json format with this schema: `utils/db_benchmark/benchmark_schema.json <../_misc/benchmark_schema.json>`_. - Files created by this function cen be viewed either by using :py:func:`~dff.utils.db_benchmark.report.report` or + Files created by this function cen be viewed either by using :py:func:`~chatsky.utils.db_benchmark.report.report` or streamlit app located in the utils directory: `utils/db_benchmark/benchmark_streamlit.py <../_misc/benchmark_streamlit.py>`_. diff --git a/dff/utils/db_benchmark/report.py b/chatsky/utils/db_benchmark/report.py similarity index 96% rename from dff/utils/db_benchmark/report.py rename to chatsky/utils/db_benchmark/report.py index 4de986c26..1bccf777a 100644 --- a/dff/utils/db_benchmark/report.py +++ b/chatsky/utils/db_benchmark/report.py @@ -21,7 +21,7 @@ def report( :param file: File with benchmark results generated by - :py:func:`~dff.utils.db_benchmark.benchmark.save_results_to_file`. + :py:func:`~chatsky.utils.db_benchmark.benchmark.save_results_to_file`. :param display: A set of objects to display in results. Values allowed inside the set: diff --git a/dff/utils/devel/__init__.py b/chatsky/utils/devel/__init__.py similarity index 100% rename from dff/utils/devel/__init__.py rename to chatsky/utils/devel/__init__.py diff --git a/dff/utils/devel/async_helpers.py b/chatsky/utils/devel/async_helpers.py similarity index 100% rename from dff/utils/devel/async_helpers.py rename to chatsky/utils/devel/async_helpers.py diff --git a/dff/utils/devel/extra_field_helpers.py b/chatsky/utils/devel/extra_field_helpers.py similarity index 100% rename from dff/utils/devel/extra_field_helpers.py rename to chatsky/utils/devel/extra_field_helpers.py diff --git a/dff/utils/devel/json_serialization.py b/chatsky/utils/devel/json_serialization.py similarity index 100% rename from dff/utils/devel/json_serialization.py rename to chatsky/utils/devel/json_serialization.py diff --git a/chatsky/utils/docker/README.md b/chatsky/utils/docker/README.md new file mode 100644 index 000000000..5b4457a54 --- /dev/null +++ b/chatsky/utils/docker/README.md @@ -0,0 +1,11 @@ +# Chatsky Docker utils + +## Description + +This directory provides Docker files, necessary for deployment +of various Chatsky utilities. + +## Contents + +* dockerfile_stats - Dockerfile for Chatsky statistics dashboard. +* entrypoint_stats.sh - Entrypoint script for Chatsky statistics dashboard. \ No newline at end of file diff --git a/dff/utils/docker/dockerfile_stats b/chatsky/utils/docker/dockerfile_stats similarity index 100% rename from dff/utils/docker/dockerfile_stats rename to chatsky/utils/docker/dockerfile_stats diff --git a/dff/utils/docker/entrypoint_stats.sh b/chatsky/utils/docker/entrypoint_stats.sh similarity index 100% rename from dff/utils/docker/entrypoint_stats.sh rename to chatsky/utils/docker/entrypoint_stats.sh diff --git a/dff/utils/docker/superset_config_docker.py b/chatsky/utils/docker/superset_config_docker.py similarity index 100% rename from dff/utils/docker/superset_config_docker.py rename to chatsky/utils/docker/superset_config_docker.py diff --git a/dff/utils/otel/otelcol-config-extras.yml b/chatsky/utils/otel/otelcol-config-extras.yml similarity index 100% rename from dff/utils/otel/otelcol-config-extras.yml rename to chatsky/utils/otel/otelcol-config-extras.yml diff --git a/dff/utils/otel/otelcol-config.yml b/chatsky/utils/otel/otelcol-config.yml similarity index 100% rename from dff/utils/otel/otelcol-config.yml rename to chatsky/utils/otel/otelcol-config.yml diff --git a/dff/utils/parser/__init__.py b/chatsky/utils/parser/__init__.py similarity index 100% rename from dff/utils/parser/__init__.py rename to chatsky/utils/parser/__init__.py diff --git a/dff/utils/testing/__init__.py b/chatsky/utils/testing/__init__.py similarity index 79% rename from dff/utils/testing/__init__.py rename to chatsky/utils/testing/__init__.py index 4e1de7c35..2e13da083 100644 --- a/dff/utils/testing/__init__.py +++ b/chatsky/utils/testing/__init__.py @@ -6,6 +6,6 @@ try: import pytest - pytest.register_assert_rewrite("dff.utils.testing.telegram") + pytest.register_assert_rewrite("chatsky.utils.testing.telegram") except ImportError: ... diff --git a/dff/utils/testing/cleanup_db.py b/chatsky/utils/testing/cleanup_db.py similarity index 98% rename from dff/utils/testing/cleanup_db.py rename to chatsky/utils/testing/cleanup_db.py index a9bdff792..fdc8f4635 100644 --- a/dff/utils/testing/cleanup_db.py +++ b/chatsky/utils/testing/cleanup_db.py @@ -7,7 +7,7 @@ import os -from dff.context_storages import ( +from chatsky.context_storages import ( JSONContextStorage, MongoContextStorage, PickleContextStorage, diff --git a/dff/utils/testing/common.py b/chatsky/utils/testing/common.py similarity index 96% rename from dff/utils/testing/common.py rename to chatsky/utils/testing/common.py index 77310b2b6..6f8890ff8 100644 --- a/dff/utils/testing/common.py +++ b/chatsky/utils/testing/common.py @@ -8,9 +8,9 @@ from typing import Callable, Tuple, Optional, Union from uuid import uuid4 -from dff.script import Context, Message -from dff.pipeline import Pipeline -from dff.utils.testing.response_comparers import default_comparer +from chatsky.script import Context, Message +from chatsky.pipeline import Pipeline +from chatsky.utils.testing.response_comparers import default_comparer def is_interactive_mode() -> bool: # pragma: no cover diff --git a/dff/utils/testing/response_comparers.py b/chatsky/utils/testing/response_comparers.py similarity index 93% rename from dff/utils/testing/response_comparers.py rename to chatsky/utils/testing/response_comparers.py index b5c86af22..dd6c9189a 100644 --- a/dff/utils/testing/response_comparers.py +++ b/chatsky/utils/testing/response_comparers.py @@ -6,7 +6,7 @@ from typing import Any, Optional -from dff.script import Context, Message +from chatsky.script import Context, Message def default_comparer(candidate: Message, reference: Message, _: Context) -> Optional[Any]: diff --git a/dff/utils/testing/toy_script.py b/chatsky/utils/testing/toy_script.py similarity index 96% rename from dff/utils/testing/toy_script.py rename to chatsky/utils/testing/toy_script.py index ee56a7ecf..1f0c38dd4 100644 --- a/dff/utils/testing/toy_script.py +++ b/chatsky/utils/testing/toy_script.py @@ -5,8 +5,8 @@ in tutorials. """ -from dff.script.conditions import exact_match -from dff.script import TRANSITIONS, RESPONSE, Message +from chatsky.script.conditions import exact_match +from chatsky.script import TRANSITIONS, RESPONSE, Message TOY_SCRIPT = { "greeting_flow": { @@ -41,7 +41,7 @@ TOY_SCRIPT_ARGS = (TOY_SCRIPT, ("greeting_flow", "start_node"), ("greeting_flow", "fallback_node")) """ -Arguments to pass to :py:meth:`~dff.pipeline.pipeline.pipeline.Pipeline.from_script` in order to +Arguments to pass to :py:meth:`~chatsky.pipeline.pipeline.pipeline.Pipeline.from_script` in order to use :py:data:`~.TOY_SCRIPT`: .. code-block:: diff --git a/dff/utils/turn_caching/__init__.py b/chatsky/utils/turn_caching/__init__.py similarity index 100% rename from dff/utils/turn_caching/__init__.py rename to chatsky/utils/turn_caching/__init__.py diff --git a/dff/utils/turn_caching/singleton_turn_caching.py b/chatsky/utils/turn_caching/singleton_turn_caching.py similarity index 100% rename from dff/utils/turn_caching/singleton_turn_caching.py rename to chatsky/utils/turn_caching/singleton_turn_caching.py diff --git a/dff/utils/viewer/__init__.py b/chatsky/utils/viewer/__init__.py similarity index 100% rename from dff/utils/viewer/__init__.py rename to chatsky/utils/viewer/__init__.py diff --git a/compose.yml b/compose.yml index dc477fd78..dd3f17c53 100644 --- a/compose.yml +++ b/compose.yml @@ -106,7 +106,7 @@ services: dashboard: env_file: [.env_file] build: - context: ./dff/utils/docker + context: ./chatsky/utils/docker dockerfile: dockerfile_stats image: ghcr.io/deeppavlov/superset_df_dashboard:latest depends_on: @@ -169,8 +169,8 @@ services: clickhouse: condition: service_healthy volumes: - - ./dff/utils/otel/otelcol-config.yml:/etc/otelcol-config.yml:ro - - ./dff/utils/otel/otelcol-config-extras.yml:/etc/otelcol-config-extras.yml:ro + - ./chatsky/utils/otel/otelcol-config.yml:/etc/otelcol-config.yml:ro + - ./chatsky/utils/otel/otelcol-config-extras.yml:/etc/otelcol-config-extras.yml:ro ports: - "4317:4317" # OTLP over gRPC receiver - "4318:4318" # OTLP over HTTP receiver diff --git a/dff/__rebuild_pydantic_models__.py b/dff/__rebuild_pydantic_models__.py deleted file mode 100644 index 6702006b7..000000000 --- a/dff/__rebuild_pydantic_models__.py +++ /dev/null @@ -1,9 +0,0 @@ -# flake8: noqa: F401 - -from dff.pipeline import Pipeline -from dff.pipeline.types import ExtraHandlerRuntimeInfo -from dff.script import Context, Script - -Script.model_rebuild() -Context.model_rebuild() -ExtraHandlerRuntimeInfo.model_rebuild() diff --git a/dff/slots/__init__.py b/dff/slots/__init__.py deleted file mode 100644 index 7579a8523..000000000 --- a/dff/slots/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# -*- coding: utf-8 -*- -# flake8: noqa: F401 - -from dff.slots.slots import GroupSlot, ValueSlot, RegexpSlot, FunctionSlot -from dff.slots.conditions import slots_extracted -from dff.slots.processing import extract, extract_all, unset, unset_all, fill_template -from dff.slots.response import filled_template diff --git a/dff/utils/db_benchmark/__init__.py b/dff/utils/db_benchmark/__init__.py deleted file mode 100644 index 6d02f7a8d..000000000 --- a/dff/utils/db_benchmark/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -*- coding: utf-8 -*- -from dff.utils.db_benchmark.benchmark import ( - time_context_read_write, - DBFactory, - BenchmarkConfig, - BenchmarkCase, - save_results_to_file, - benchmark_all, -) -from dff.utils.db_benchmark.report import report -from dff.utils.db_benchmark.basic_config import BasicBenchmarkConfig, basic_configurations diff --git a/dff/utils/docker/README.md b/dff/utils/docker/README.md deleted file mode 100644 index 6caf4490f..000000000 --- a/dff/utils/docker/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# DFF Docker utils - -## Description - -This directory provides Docker files, necessary for deployment -of various DFF utilities. - -## Contents - -* dockerfile_stats - Dockerfile for DFF statistics dashboard. -* entrypoint_stats.sh - Entrypoint script for DFF statistics dashboard. \ No newline at end of file diff --git a/docs/source/_templates/example-links.html b/docs/source/_templates/example-links.html index 6e03f6b22..5ba1edc8f 100644 --- a/docs/source/_templates/example-links.html +++ b/docs/source/_templates/example-links.html @@ -1,8 +1,8 @@ {% if meta is defined and meta is not none and 'tutorial_name' in meta %} {% set repo_path = "/".join(meta['tutorial_name'].split("/")[-1].split(".")) %} - {% set github_link = 'https://github.com/deeppavlov/dialog_flow_framework/blob/master/' ~ repo_path ~ '.py' %} + {% set github_link = 'https://github.com/deeppavlov/chatsky/blob/master/' ~ repo_path ~ '.py' %} {% set notebook_link = '../' ~ meta['tutorial_name'] ~ '.ipynb' %} - {% set colab_link = 'https://colab.research.google.com/github/deeppavlov/dialog_flow_framework/blob/gh-pages/' ~ meta['tutorial_name'] ~ '.ipynb' %} + {% set colab_link = 'https://colab.research.google.com/github/deeppavlov/chatsky/blob/gh-pages/' ~ meta['tutorial_name'] ~ '.ipynb' %}