Extensible package for creating machine learning powered chatbots.
Project description
Chat Toolkit
Extensible package for creating machine learning powered chatbots.
NOTE: Linux users may need to install PortAudio. Please check their
documentation for the best way to install on your system. For Ubuntu
users, sudo apt-get install libportaudio2
should do the trick.
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}]]
optional arguments:
-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.
To quickly start up a TextToTextOrchestrator (both are equivalent):
python -m chat_toolkit
OR
python -m chat_toolkit --chatbot chatgpt
To quickly start up a SpeechToTextOrchestrator (all are equivalent):
python -m chat_toolkit --speech-to-text
OR
python -m chat_toolkit --speech-to-text whisper
OR
python -m chat_toolkit --chatbot chatgpt --speech-to-text whisper
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 | Models Available | Reference |
---|---|---|---|
OpenAIChatBot | OPENAI_API_KEY | gpt-3.5-turbo (ChatGPT) | OpenAI |
Basic Usage:
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 | Models Available | Reference |
---|---|---|---|
OpenAISpeechToText | OPENAI_API_KEY | whiper-1 | OpenAI |
Basic Usage:
from chat_toolkit import OpenAISpeechToText
speech_to_text = OpenAISpeechToText()
text, _ = speech_to_text.record_and_transcribe()
Advanced Usage: You can create your own speech to text components by subclassing
chat_toolkit.base.SpeechToTextComponentBase
Orchestrators
Orchestrators are modes of chatting that orchestrate one or more components differently. They also allow you to chat from the terminal. Orchestrators 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.
Advanced Usage: You can create your own orchestration classes by subclassing
chat_toolkit.base.OrchestratorBase
TextToTextOrchestrator
Basic usage:
from chat_toolkit.components import OpenAIChatBot
from chat_toolkit.orchestrators import TextToTextOrchestrator
chat = TextToTextOrchestrator(OpenAIChatBot())
chat.terminal_conversation()
SpeechToTextOrchestrator
Basic usage:
from chat_toolkit.components import OpenAIChatBot, OpenAISpeechToText
from chat_toolkit.orchestrators import SpeechToTextOrchestrator
chat = SpeechToTextOrchestrator(OpenAIChatBot(), OpenAISpeechToText())
chat.terminal_conversation()
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
Built Distribution
File details
Details for the file chat_toolkit-1.0.0.tar.gz
.
File metadata
- Download URL: chat_toolkit-1.0.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.0 Linux/5.15.0-1033-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c80ef483a8c49a7ad37a14fad082ae94ee9ba7dbb0e1f55d45b7f4ec9210753a |
|
MD5 | 3c44adcdc0c25308cfdf66c6926a73dc |
|
BLAKE2b-256 | 78903e1c6b4f86296142a05805993bef24d9944f5b24c8b162ba60d005c99792 |
File details
Details for the file chat_toolkit-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: chat_toolkit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.11.0 Linux/5.15.0-1033-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a26455d5eac6b7ff7654be4e42626dbc7df6395bc7a8dedef822e7a942f2a93 |
|
MD5 | 61b5dbe63c3119d2f716dfa2ddfc5fb9 |
|
BLAKE2b-256 | bcc4a03b9ea94ea80fac081768613526eba55b44986b29d151f7202739ae90da |