Skip to main content

Chatsky is a free and open-source software stack for creating chatbots, released under the terms of Apache License 2.0.

Project description

Chatsky

Documentation Status Codestyle Tests License Apache 2.0 Python 3.9, 3.10, 3.11, 3.12 PyPI Downloads

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.

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 Chatsky, with options such as AWS Lambda and Azure Functions providing serverless execution.
  • 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, 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 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 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

System Requirements

  • Supported operating systems include Ubuntu 18.04+, Windows 10+ (partial support), and MacOS Big Sur (partial support);
  • Python version 3.9 or higher is necessary for proper functionality;
  • A minimum of 1 GB of RAM is required for optimal performance;
  • If analytics collection or database integration is intended, Docker version 20 or higher may be necessary.

Installation

Chatsky can be installed via pip:

pip install chatsky

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:

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.

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.

from chatsky import (
    GLOBAL,
    TRANSITIONS,
    RESPONSE,
    Pipeline,
    conditions as cnd,
    Transition as Tr,
)

# create a dialog script
script = {
    GLOBAL: {
        TRANSITIONS: [
            Tr(
                dst=("flow", "node_hi"),
                cnd=cnd.ExactMatch("Hi"),
            ),
            Tr(
                dst=("flow", "node_ok")
            )
        ]
    },
    "flow": {
        "node_hi": {RESPONSE: "Hi!"},
        "node_ok": {RESPONSE: "OK"},
    },
}

# initialize Pipeline (needed to run the script)
pipeline = Pipeline(script, start_label=("flow", "node_hi"))


pipeline.run()

When you run this code, you get similar output:

request: hi
response: text='OK'
request: Hi
response: text='Hi!'

More advanced examples are available as a part of documentation: tutorials.

Further steps

To further explore the API of the framework, you can make use of the detailed documentation. 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 Chatsky

We are open to accepting pull requests and bug reports. Please refer to CONTRIBUTING.md.

License

Chatsky is distributed under the terms of the Apache License 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chatsky-0.9.0.dev1.tar.gz (103.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chatsky-0.9.0.dev1-py3-none-any.whl (154.1 kB view details)

Uploaded Python 3

File details

Details for the file chatsky-0.9.0.dev1.tar.gz.

File metadata

  • Download URL: chatsky-0.9.0.dev1.tar.gz
  • Upload date:
  • Size: 103.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.12.4-zen1-1-zen

File hashes

Hashes for chatsky-0.9.0.dev1.tar.gz
Algorithm Hash digest
SHA256 a5f7ac9e810095d34788f39f35825799da2857c7698caad1cd12a1c70ef7061c
MD5 58b8b1d39772bdebc9b331a5d97b85d4
BLAKE2b-256 0a9c6e313ed22c5af895c5463b52f9755918fe1eac62120067250c804f806bae

See more details on using hashes here.

File details

Details for the file chatsky-0.9.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: chatsky-0.9.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 154.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.12.4-zen1-1-zen

File hashes

Hashes for chatsky-0.9.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 b49acf9abaf5e12fcdd1f03fd47d8f1b9dc373a4fa2e8ece19961be03152b2e2
MD5 c026a9d86e1185905de4d09765edaa05
BLAKE2b-256 871302e23c9158893d160fc121ff95ff9cbb8d67b217ac869293070b7c261850

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page