Skip to content

Commit

Permalink
Replace dff with chatsky (#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
RLKRo authored Jul 3, 2024
1 parent a2fe683 commit a2ba8fc
Show file tree
Hide file tree
Showing 220 changed files with 1,035 additions and 1,029 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/update_dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- 'master'
paths:
- 'dff/utils/docker/**'
- 'chatsky/utils/docker/**'
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -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 }}
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down
80 changes: 40 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -44,44 +44,44 @@ 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

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 = {
Expand Down Expand Up @@ -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).
6 changes: 3 additions & 3 deletions dff/__init__.py → chatsky/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__
9 changes: 9 additions & 0 deletions chatsky/__rebuild_pydantic_models__.py
Original file line number Diff line number Diff line change
@@ -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()
4 changes: 2 additions & 2 deletions dff/config/README.md → chatsky/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Use `chatsky.stats -h` for more info.
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -297,7 +297,7 @@ position:
HEADER_ID:
id: HEADER_ID
meta:
text: DFF statistics dashboard
text: Chatsky statistics dashboard
type: HEADER
MARKDOWN-8Q9BhcEwva:
children: []
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
table_name: dff_final_nodes
table_name: chatsky_final_nodes
main_dttm_col: null
description: null
default_endpoint: null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
table_name: dff_node_stats
table_name: chatsky_node_stats
main_dttm_col: null
description: null
default_endpoint: null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
table_name: dff_stats
table_name: chatsky_stats
main_dttm_col: null
description: null
default_endpoint: null
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand All @@ -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"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
"""

Expand All @@ -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 ""
File renamed without changes.
Loading

0 comments on commit a2ba8fc

Please sign in to comment.