Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add slots to parser #375

Merged
merged 58 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
8312768
show workflow badges for dev branch
RLKRo Dec 26, 2023
afe8a89
Add System Requirements into README.md (#295)
kudep Dec 27, 2023
ca28bec
Add into README.md info about target platform (#294)
kudep Dec 27, 2023
18908d0
check pip deps weekly
RLKRo Dec 28, 2023
6e74128
format
RLKRo Feb 22, 2024
ac34686
add kwargs to message init
RLKRo Feb 28, 2024
b8c4bc6
Remove MultiMessage (#330)
RLKRo Feb 29, 2024
bf68c76
build(deps): bump the deps group with 16 updates (#326)
dependabot[bot] Feb 29, 2024
2b5915a
disable validation by default
RLKRo Feb 29, 2024
e968fd0
include exception info in logger
RLKRo Feb 29, 2024
97026ae
fix happy_path for response tutorial
RLKRo Feb 29, 2024
08672c0
remove pre_response and pre_transition processing tutorials
RLKRo Mar 1, 2024
3e6f815
remove redundant tutorial tests
RLKRo Mar 1, 2024
5b8460a
[hotfix] remove user function calls from validation (#331)
RLKRo Mar 1, 2024
1042493
update package version
RLKRo Mar 1, 2024
224eaf1
Merge pull request #333 from deeppavlov/dev
RLKRo Mar 1, 2024
a76884d
fix tutorial
RLKRo Mar 12, 2024
9e62a84
Add condition asserting str is in Message.text (#335)
ZergLev Mar 15, 2024
4d46718
skip tests on empty string tg credentials
RLKRo Mar 18, 2024
cda7984
fix condition docstrings
RLKRo Mar 18, 2024
32ce6fe
Minor fix in CONTRIBUTING.md (#339)
ZergLev Mar 18, 2024
957fb01
build(deps-dev): bump the deps group with 7 updates (#338)
dependabot[bot] Mar 18, 2024
1dd0735
mention pandoc in CONTRIBUTING.md
RLKRo Mar 20, 2024
0e39538
Revert "remove pre_response and pre_transition processing tutorials"
RLKRo Mar 22, 2024
ce658bd
Merge branch 'master' into dev
RLKRo Mar 22, 2024
cb74741
build(deps-dev): bump the deps group with 2 updates (#343)
dependabot[bot] Mar 25, 2024
fbfc084
build(deps-dev): bump black from 24.2.0 to 24.3.0 (#340)
dependabot[bot] Apr 2, 2024
5ccead1
Actor revalidation (#289)
pseusys Apr 15, 2024
7d40565
build(deps): bump the deps group with 12 updates (#350)
dependabot[bot] Apr 15, 2024
abb0480
build(deps): bump the deps group with 2 updates (#352)
dependabot[bot] Apr 23, 2024
2e1aeb1
return venv to ignore files
RLKRo May 6, 2024
44fbd5a
build(deps): bump the deps group across 1 directory with 17 updates (…
dependabot[bot] Jun 19, 2024
5f73d05
update exclude-members with some pydantic fields (#361)
RLKRo Jun 19, 2024
b5ed32e
Fix tutorial error and update API reference (#334)
ZergLev Jun 19, 2024
4c087cf
Make functions accept str along with Message (#337)
ZergLev Jun 19, 2024
facc5f7
Add quick test command (#344)
RLKRo Jun 19, 2024
f631e08
framework states rework (#359)
RLKRo Jun 20, 2024
ca84b4b
Fix stats (#366)
RLKRo Jul 2, 2024
1593559
Telegram interface upgrade (#328)
pseusys Jul 2, 2024
a2fe683
Merge slots (#36)
RLKRo Jul 2, 2024
a2ba8fc
Replace dff with chatsky (#368)
RLKRo Jul 3, 2024
eed21e0
remove TG_API_* secrets
RLKRo Jul 3, 2024
dd754dd
update package version
RLKRo Jul 3, 2024
be403df
update poetry lock
RLKRo Jul 3, 2024
521ec39
remove outdated checklist item
RLKRo Jul 3, 2024
b07d9ed
update telegram test data
RLKRo Jul 3, 2024
9062254
fix doc
RLKRo Jul 3, 2024
8c559cc
update project links
RLKRo Jul 3, 2024
dfefedb
Release v0.8 (#369)
RLKRo Jul 3, 2024
9323475
`pepy` badge fix (#370)
pseusys Jul 5, 2024
702ddc8
Merge branch 'master' into 'chore/slots2parser'
Ramimashkouk Jul 18, 2024
0c53232
Merge branch 'master' into chore/slots2parser
Ramimashkouk Jul 22, 2024
d787906
feat: Integrate slots parsing
Ramimashkouk Jul 22, 2024
8a4781d
chore: Add pre-transitions to script example
Ramimashkouk Jul 23, 2024
486a432
refactor: Use a consistent approach with slots
Ramimashkouk Aug 15, 2024
8ff6bf0
fix annotated import
RLKRo Aug 27, 2024
6174f9a
remove redundant config parsing
RLKRo Aug 27, 2024
acc2bc0
fix slot regex in examples
RLKRo Aug 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.DS_Store*
*.egg-info/
dist/
venv/
build/
docs/source/apiref
docs/source/_misc
Expand All @@ -21,6 +22,7 @@ GlobalUserTableAccessor*
memory_debugging*
opening_database*
_globals.py
venv*
.vscode
.coverage
.coverage.*
Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ updates:
directory: "/"
target-branch: dev
schedule:
interval: "daily"
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
Expand Down
4 changes: 1 addition & 3 deletions .github/process_github_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ def post_comment_on_pr(comment: str, pr_number: int):
- [ ] Update package version
- [ ] Update `poetry.lock`
- [ ] Change PR merge option
- [ ] Test modules without automated testing:
- [ ] Requiring telegram `api_id` and `api_hash`
- [ ] Requiring `HF_API_KEY`
- [ ] Update template repo
- [ ] Search for objects to be deprecated
"""

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/build_and_publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ jobs:
- name: build documentation
env:
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }}
TG_API_ID: ${{ secrets.TG_API_ID }}
TG_API_HASH: ${{ secrets.TG_API_HASH }}
TG_BOT_USERNAME: ${{ secrets.TG_BOT_USERNAME }}
run: |
python -m poetry run poe docs
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ jobs:
- name: run tests
env:
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }}
TG_API_ID: ${{ secrets.TG_API_ID }}
TG_API_HASH: ${{ secrets.TG_API_HASH }}
TG_BOT_USERNAME: ${{ secrets.TG_BOT_USERNAME }}
run: |
python -m poetry run poe test_all
4 changes: 0 additions & 4 deletions .github/workflows/test_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ jobs:
- name: run pytest
env:
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }}
TG_API_ID: ${{ secrets.TG_API_ID }}
TG_API_HASH: ${{ secrets.TG_API_HASH }}
TG_BOT_USERNAME: ${{ secrets.TG_BOT_USERNAME }}
run: |
python -m poetry run poe test_no_cov
Expand All @@ -64,8 +62,6 @@ jobs:
- name: run pytest
env:
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }}
TG_API_ID: ${{ secrets.TG_API_ID }}
TG_API_HASH: ${{ secrets.TG_API_HASH }}
TG_BOT_USERNAME: ${{ secrets.TG_BOT_USERNAME }}
run: |
python -m poetry run poe test_no_deps
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 }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.DS_Store*
*.egg-info/
dist/
venv/
build/
docs/source/apiref
docs/source/_misc
Expand All @@ -21,6 +22,7 @@ GlobalUserTableAccessor*
memory_debugging*
opening_database*
_globals.py
venv*
.vscode
.coverage
.coverage.*
Expand Down
39 changes: 14 additions & 25 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 @@ -69,27 +69,9 @@ by activating the virtual environment and then running
poetry run poe docs
```

After that `docs/build` dir will be created and you can open index file `docs/build/index.html` in your browser of choice.

#### Documentation links

In your tutorials, you can use special expanding directives in markdown cells.
They can help shorten the comments and avoid boilerplate code.
The documentation links generated by the directives are always relative
to the local documentation and verified during build.
Note that you'll need `pandoc` installed on your system in order to build docs.

- `%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[...]`.
- `%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.
- `%mddoclink({args})`
This directive is a shortcut for `%doclink` that generates a markdown format link instead.

The generated link will be either `[ARG2](%doclink(ARG1,ARG2))` or `[ARG3](%doclink(ARG1,ARG2,ARG3))`.
After that `docs/build` dir will be created and you can open index file `docs/build/index.html` in your browser of choice.

#### Documentation links

Expand All @@ -101,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 All @@ -132,6 +114,13 @@ poetry run poe test_all
```
for successful execution of this command `Docker` and `docker compose` are required.

To do a quick sanity check without the need to up docker containers or wait for long tests, run
```bash
poetry run poe quick_test
```

_There's also quick_test_coverage for quick htmlcov generation, though it is very likely to be incomplete due to deselection of some tests._

To make sure that the code satisfies only the style requirements, run
```bash
poetry run poe lint
Expand All @@ -144,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
82 changes: 41 additions & 41 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://static.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,50 +44,50 @@ 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 = {
GLOBAL: {
TRANSITIONS: {
("flow", "node_hi"): cnd.exact_match(Message("Hi")),
("flow", "node_hi"): cnd.exact_match("Hi"),
("flow", "node_ok"): cnd.true()
}
},
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).
8 changes: 5 additions & 3 deletions dff/__init__.py → chatsky/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

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

from dff.msg import *
from chatsky.msg import *

Script.model_rebuild()

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()
1 change: 1 addition & 0 deletions chatsky/cnd.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from chatsky.script.conditions import *
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.
Loading