Skip to main content

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 import OpenAIChatBot
from chat_toolkit import TextToTextOrchestrator

chat = TextToTextOrchestrator(OpenAIChatBot())
chat.terminal_conversation()

SpeechToTextOrchestrator

Basic usage:

from chat_toolkit import OpenAIChatBot, OpenAISpeechToText
from chat_toolkit 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

chat_toolkit-1.0.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

chat_toolkit-1.0.1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file chat_toolkit-1.0.1.tar.gz.

File metadata

  • Download URL: chat_toolkit-1.0.1.tar.gz
  • Upload date:
  • Size: 11.5 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

Hashes for chat_toolkit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 aa569a5ce94c089176999054ee1b2c79a7430a47b1ffe87f5a20c0f26dbed5d6
MD5 24f707c81408db5230e474f6c4b692e9
BLAKE2b-256 6dbd8cff193e612574cf598980769bb49719de43af206488b9bea1971e73268b

See more details on using hashes here.

File details

Details for the file chat_toolkit-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: chat_toolkit-1.0.1-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

Hashes for chat_toolkit-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2ac0c1325a68849fa0d79711f1f52bcab1b0abbf78cd72b73ff7bc1d763640c1
MD5 d848c01f0cb637979419818fd23d2fd9
BLAKE2b-256 e7cf4ec8fb2af50c55cb78abbdb850b0412aae08c447cb62afa8cdcb74f1a971

See more details on using hashes here.

Supported by

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