chat-toolkit


Namechat-toolkit JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/danb27/chat-toolkit
SummaryExtensible package for creating machine learning powered chatbots.
upload_time2023-03-21 16:31:00
maintainer
docs_urlNone
authordanb27
requires_python>=3.9,<4.0
licenseMIT
keywords chatbot chatgpt conversational ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- TOC -->
* [Chat Toolkit](#chat-toolkit)
  * [Installation](#installation)
  * [Quick Usage](#quick-usage)
  * [Components](#components)
    * [Chatbots](#chatbots)
    * [Speech to Text](#speech-to-text)
    * [Text to Speech](#text-to-speech)
  * [Orchestrator](#orchestrator)
    * [Text to Text](#text-to-text)
    * [Speech to Text](#speech-to-text-1)
    * [Text to Speech](#text-to-speech-1)
    * [Speech to Speech](#speech-to-speech)
<!-- TOC -->

# Chat Toolkit

Extensible package for creating machine learning powered chatbots.

Package supports Linux and Windows. Mac is not explicitly supported, although it is possible some, or many parts of this will still work.

**NOTE**: Some components require additional dependencies. See below for more information.

## Installation

`pip install -U chat-toolkit`

## Quick Usage

The main script has been provided for convenience. This allows you to easily
start a conversation in your terminal.

Usage:

```
usage: A script for quickly starting a conversation in your terminal. [-h] [--chatbot {chatgpt}]
                                                                      [--speech-to-text [{whisper}]]
                                                                      [--text-to-speech [{pyttsx3}]]

options:
  -h, --help                        show this help message and exit
  --chatbot {chatgpt}               Chatbot to use. Default: chatgpt.
  --speech-to-text [{whisper}]      Speech to text model to use. Without additional arguments, defaults to whisper. Defaults to
                                    None when argument is not present.
  --text-to-speech [{pyttsx3}]      Text to speech model to use. Without additional arguments, defaults to pyttsx3. Defaults to
                                    None when argument is not present.

```

To quickly start up a Text to Text conversation (default models):

`python -m chat_toolkit`

To quickly start up a Speech to Text conversation (default models):

`python -m chat_toolkit --speech-to-text`

To quickly start up a Text to Speech conversation (default models):

`python -m chat_toolkit --text-to-speech`

To quickly start up a Speech to Speech conversation (default models):

`python -m chat_toolkit --speech-to-text --text-to-speech`

## Components

Components are ML powered objects that accomplish tasks. Components should be
able to estimate session costs. You can build your own components to use in
isolation or as part of an orchestrator object.

**NOTE**: Cost estimates are based on pricing rates provided by the user. Users
should do their own due dilligence and are responsible for their own costs and
estimations.

> Advanced Usage: You can create your own component types by
> subclassing `chat_toolkit.base.ComponentBase`

### Chatbots

These components send and receive text messages.

| Class         | Requirements   | Model                   | Default Cost     | Reference                                                                    |
|---------------|----------------|-------------------------|------------------|------------------------------------------------------------------------------|
| OpenAIChatBot | OPENAI_API_KEY | gpt-3.5-turbo (ChatGPT) | $0.002/1k tokens | [OpenAI](https://platform.openai.com/docs/guides/chat/chat-completions-beta) |

Basic Usage:

```python
from chat_toolkit import OpenAIChatBot

chatbot = OpenAIChatBot()
chatbot.prompt_chatbot("You are a butler named Jeeves.")
chatbot_response, _ = chatbot.send_message("Hello, what is your name?")
```

> Advanced Usage: You can create your own chatbot components by
> subclassing `chat_toolkit.base.ChatbotComponentBase`

### Speech to Text

These components record speech and transform it into text.

| Class              | Requirements                          | Model    | Default Cost     | Reference                                                                            |
|--------------------|---------------------------------------|----------|------------------|--------------------------------------------------------------------------------------|
| OpenAISpeechToText | OPENAI_API_KEY, libportaudio2 (linux) | whiper-1 | $0.006/1k tokens | [OpenAI](https://platform.openai.com/docs/guides/speech-to-text/speech-to-text-beta) |

Basic Usage:

```python
from chat_toolkit import OpenAISpeechToText

speech_to_text = OpenAISpeechToText()
text, _ = speech_to_text.transcribe_speech()
```

**NOTE**: Recording quality is very sensitive to your hardware. Things can go wrong,
for example, if the input volume on your microphone is too loud.

> Advanced Usage: You can create your own speech to text components by
> subclassing `chat_toolkit.base.SpeechToTextComponentBase`

### Text to Speech

These components say pieces of text.

| ClassTextToSpeech   | Requirements   | Model  | Default Cost | Reference                                            |
|---------------------|----------------|--------|--------------|------------------------------------------------------|
| Pyttsx3TextToSpeech | espeak (linux) | n/a    | Free         | [Pyttsx3](https://pyttsx3.readthedocs.io/en/latest/) |

**NOTE**: Pyttsx3TextToSpeech currently defaults to English, but it may be configured using `set_pyttsx3_property()` method. See pyttsx3's documentation for more information.

Basic Usage:

```python
from chat_toolkit import Pyttsx3TextToSpeech

text_to_speech = Pyttsx3TextToSpeech()
text_to_speech.say_text("hello")
```

> Advanced Usage: You can create your own text to speech components by
> subclassing `chat_toolkit.base.TextToSpeechComponentBase`

## Orchestrator

The Orchestrator class also allow you to chat from the terminal. The Orchestrator
should work such that you can replace any component with another of the
same type, or a custom-built one, and still be able to use the orchestrator.

### Text to Text

Basic usage:

```python
from chat_toolkit import OpenAIChatBot
from chat_toolkit import Orchestrator

chat = Orchestrator(OpenAIChatBot())
chat.terminal_conversation()
```

### Speech to Text

Basic usage:

```python
from chat_toolkit import OpenAIChatBot, OpenAISpeechToText
from chat_toolkit import Orchestrator

chat = Orchestrator(OpenAIChatBot(), OpenAISpeechToText())
chat.terminal_conversation()
```

### Text to Speech

Basic usage:

```python
from chat_toolkit import OpenAIChatBot, Pyttsx3TextToSpeech
from chat_toolkit import Orchestrator

chat = Orchestrator(OpenAIChatBot(), text_to_speech_component=Pyttsx3TextToSpeech())
chat.terminal_conversation()
```


### Speech to Speech

Basic usage:

```python
from chat_toolkit import OpenAIChatBot, OpenAISpeechToText, Pyttsx3TextToSpeech
from chat_toolkit import Orchestrator

chat = Orchestrator(OpenAIChatBot(), OpenAISpeechToText(), Pyttsx3TextToSpeech())
chat.terminal_conversation()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/danb27/chat-toolkit",
    "name": "chat-toolkit",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "chatbot,chatgpt,conversational AI",
    "author": "danb27",
    "author_email": "danbianchini@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/b8/71/7155ca14be1e11e9533fbdf1fc4f244c271f4e21b39ef176afbb3ea46a46/chat_toolkit-1.1.1.tar.gz",
    "platform": null,
    "description": "<!-- TOC -->\n* [Chat Toolkit](#chat-toolkit)\n  * [Installation](#installation)\n  * [Quick Usage](#quick-usage)\n  * [Components](#components)\n    * [Chatbots](#chatbots)\n    * [Speech to Text](#speech-to-text)\n    * [Text to Speech](#text-to-speech)\n  * [Orchestrator](#orchestrator)\n    * [Text to Text](#text-to-text)\n    * [Speech to Text](#speech-to-text-1)\n    * [Text to Speech](#text-to-speech-1)\n    * [Speech to Speech](#speech-to-speech)\n<!-- TOC -->\n\n# Chat Toolkit\n\nExtensible package for creating machine learning powered chatbots.\n\nPackage supports Linux and Windows. Mac is not explicitly supported, although it is possible some, or many parts of this will still work.\n\n**NOTE**: Some components require additional dependencies. See below for more information.\n\n## Installation\n\n`pip install -U chat-toolkit`\n\n## Quick Usage\n\nThe main script has been provided for convenience. This allows you to easily\nstart a conversation in your terminal.\n\nUsage:\n\n```\nusage: A script for quickly starting a conversation in your terminal. [-h] [--chatbot {chatgpt}]\n                                                                      [--speech-to-text [{whisper}]]\n                                                                      [--text-to-speech [{pyttsx3}]]\n\noptions:\n  -h, --help                        show this help message and exit\n  --chatbot {chatgpt}               Chatbot to use. Default: chatgpt.\n  --speech-to-text [{whisper}]      Speech to text model to use. Without additional arguments, defaults to whisper. Defaults to\n                                    None when argument is not present.\n  --text-to-speech [{pyttsx3}]      Text to speech model to use. Without additional arguments, defaults to pyttsx3. Defaults to\n                                    None when argument is not present.\n\n```\n\nTo quickly start up a Text to Text conversation (default models):\n\n`python -m chat_toolkit`\n\nTo quickly start up a Speech to Text conversation (default models):\n\n`python -m chat_toolkit --speech-to-text`\n\nTo quickly start up a Text to Speech conversation (default models):\n\n`python -m chat_toolkit --text-to-speech`\n\nTo quickly start up a Speech to Speech conversation (default models):\n\n`python -m chat_toolkit --speech-to-text --text-to-speech`\n\n## Components\n\nComponents are ML powered objects that accomplish tasks. Components should be\nable to estimate session costs. You can build your own components to use in\nisolation or as part of an orchestrator object.\n\n**NOTE**: Cost estimates are based on pricing rates provided by the user. Users\nshould do their own due dilligence and are responsible for their own costs and\nestimations.\n\n> Advanced Usage: You can create your own component types by\n> subclassing `chat_toolkit.base.ComponentBase`\n\n### Chatbots\n\nThese components send and receive text messages.\n\n| Class         | Requirements   | Model                   | Default Cost     | Reference                                                                    |\n|---------------|----------------|-------------------------|------------------|------------------------------------------------------------------------------|\n| OpenAIChatBot | OPENAI_API_KEY | gpt-3.5-turbo (ChatGPT) | $0.002/1k tokens | [OpenAI](https://platform.openai.com/docs/guides/chat/chat-completions-beta) |\n\nBasic Usage:\n\n```python\nfrom chat_toolkit import OpenAIChatBot\n\nchatbot = OpenAIChatBot()\nchatbot.prompt_chatbot(\"You are a butler named Jeeves.\")\nchatbot_response, _ = chatbot.send_message(\"Hello, what is your name?\")\n```\n\n> Advanced Usage: You can create your own chatbot components by\n> subclassing `chat_toolkit.base.ChatbotComponentBase`\n\n### Speech to Text\n\nThese components record speech and transform it into text.\n\n| Class              | Requirements                          | Model    | Default Cost     | Reference                                                                            |\n|--------------------|---------------------------------------|----------|------------------|--------------------------------------------------------------------------------------|\n| OpenAISpeechToText | OPENAI_API_KEY, libportaudio2 (linux) | whiper-1 | $0.006/1k tokens | [OpenAI](https://platform.openai.com/docs/guides/speech-to-text/speech-to-text-beta) |\n\nBasic Usage:\n\n```python\nfrom chat_toolkit import OpenAISpeechToText\n\nspeech_to_text = OpenAISpeechToText()\ntext, _ = speech_to_text.transcribe_speech()\n```\n\n**NOTE**: Recording quality is very sensitive to your hardware. Things can go wrong,\nfor example, if the input volume on your microphone is too loud.\n\n> Advanced Usage: You can create your own speech to text components by\n> subclassing `chat_toolkit.base.SpeechToTextComponentBase`\n\n### Text to Speech\n\nThese components say pieces of text.\n\n| ClassTextToSpeech   | Requirements   | Model  | Default Cost | Reference                                            |\n|---------------------|----------------|--------|--------------|------------------------------------------------------|\n| Pyttsx3TextToSpeech | espeak (linux) | n/a    | Free         | [Pyttsx3](https://pyttsx3.readthedocs.io/en/latest/) |\n\n**NOTE**: Pyttsx3TextToSpeech currently defaults to English, but it may be configured using `set_pyttsx3_property()` method. See pyttsx3's documentation for more information.\n\nBasic Usage:\n\n```python\nfrom chat_toolkit import Pyttsx3TextToSpeech\n\ntext_to_speech = Pyttsx3TextToSpeech()\ntext_to_speech.say_text(\"hello\")\n```\n\n> Advanced Usage: You can create your own text to speech components by\n> subclassing `chat_toolkit.base.TextToSpeechComponentBase`\n\n## Orchestrator\n\nThe Orchestrator class also allow you to chat from the terminal. The Orchestrator\nshould work such that you can replace any component with another of the\nsame type, or a custom-built one, and still be able to use the orchestrator.\n\n### Text to Text\n\nBasic usage:\n\n```python\nfrom chat_toolkit import OpenAIChatBot\nfrom chat_toolkit import Orchestrator\n\nchat = Orchestrator(OpenAIChatBot())\nchat.terminal_conversation()\n```\n\n### Speech to Text\n\nBasic usage:\n\n```python\nfrom chat_toolkit import OpenAIChatBot, OpenAISpeechToText\nfrom chat_toolkit import Orchestrator\n\nchat = Orchestrator(OpenAIChatBot(), OpenAISpeechToText())\nchat.terminal_conversation()\n```\n\n### Text to Speech\n\nBasic usage:\n\n```python\nfrom chat_toolkit import OpenAIChatBot, Pyttsx3TextToSpeech\nfrom chat_toolkit import Orchestrator\n\nchat = Orchestrator(OpenAIChatBot(), text_to_speech_component=Pyttsx3TextToSpeech())\nchat.terminal_conversation()\n```\n\n\n### Speech to Speech\n\nBasic usage:\n\n```python\nfrom chat_toolkit import OpenAIChatBot, OpenAISpeechToText, Pyttsx3TextToSpeech\nfrom chat_toolkit import Orchestrator\n\nchat = Orchestrator(OpenAIChatBot(), OpenAISpeechToText(), Pyttsx3TextToSpeech())\nchat.terminal_conversation()\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Extensible package for creating machine learning powered chatbots.",
    "version": "1.1.1",
    "split_keywords": [
        "chatbot",
        "chatgpt",
        "conversational ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d070792d8cda8694a40adab5b9a3a96514c2788b04085b9b4010d4add3d962e4",
                "md5": "846fde70ebcedf8481fee3e720a24989",
                "sha256": "f5fe80878faba25d01f7eb309203eb3170ec5e231af7b8802fb2aab75b9cbda5"
            },
            "downloads": -1,
            "filename": "chat_toolkit-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "846fde70ebcedf8481fee3e720a24989",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 18338,
            "upload_time": "2023-03-21T16:30:58",
            "upload_time_iso_8601": "2023-03-21T16:30:58.398230Z",
            "url": "https://files.pythonhosted.org/packages/d0/70/792d8cda8694a40adab5b9a3a96514c2788b04085b9b4010d4add3d962e4/chat_toolkit-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b8717155ca14be1e11e9533fbdf1fc4f244c271f4e21b39ef176afbb3ea46a46",
                "md5": "dc6d8af6173b84e7060f8ad0f011a323",
                "sha256": "63857b1b0a119ec46f8ddde9cdc04f23442f9badca97446ea4cdbb22b858087c"
            },
            "downloads": -1,
            "filename": "chat_toolkit-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "dc6d8af6173b84e7060f8ad0f011a323",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 13695,
            "upload_time": "2023-03-21T16:31:00",
            "upload_time_iso_8601": "2023-03-21T16:31:00.343048Z",
            "url": "https://files.pythonhosted.org/packages/b8/71/7155ca14be1e11e9533fbdf1fc4f244c271f4e21b39ef176afbb3ea46a46/chat_toolkit-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-21 16:31:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "danb27",
    "github_project": "chat-toolkit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "chat-toolkit"
}
        
Elapsed time: 0.04604s