Package: chat-toolkit
Chat ToolkitInstallationQuick UsageComponentsChatbotsSpeech to TextText to SpeechOrchestratorText to TextSpeech to TextText to SpeechSpeech to SpeechChat ToolkitExtensible 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.Installationpip install -U chat-toolkitQuick UsageThe 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_toolkitTo quickly start up a Speech to Text conversation (default models):python -m chat_toolkit --speech-to-textTo quickly start up a Text to Speech conversation (default models):python -m chat_toolkit --text-to-speechTo quickly start up a Speech to Speech conversation (default models):python -m chat_toolkit --speech-to-text --text-to-speechComponentsComponents 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
subclassingchat_toolkit.base.ComponentBaseChatbotsThese components send and receive text messages.ClassRequirementsModelDefault CostReferenceOpenAIChatBotOPENAI_API_KEYgpt-3.5-turbo (ChatGPT)$0.002/1k tokensOpenAIBasic Usage:fromchat_toolkitimportOpenAIChatBotchatbot=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
subclassingchat_toolkit.base.ChatbotComponentBaseSpeech to TextThese components record speech and transform it into text.ClassRequirementsModelDefault CostReferenceOpenAISpeechToTextOPENAI_API_KEY, libportaudio2 (linux)whiper-1$0.006/1k tokensOpenAIBasic Usage:fromchat_toolkitimportOpenAISpeechToTextspeech_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
subclassingchat_toolkit.base.SpeechToTextComponentBaseText to SpeechThese components say pieces of text.ClassTextToSpeechRequirementsModelDefault CostReferencePyttsx3TextToSpeechespeak (linux)n/aFreePyttsx3NOTE: Pyttsx3TextToSpeech currently defaults to English, but it may be configured usingset_pyttsx3_property()method. See pyttsx3's documentation for more information.Basic Usage:fromchat_toolkitimportPyttsx3TextToSpeechtext_to_speech=Pyttsx3TextToSpeech()text_to_speech.say_text("hello")Advanced Usage: You can create your own text to speech components by
subclassingchat_toolkit.base.TextToSpeechComponentBaseOrchestratorThe 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 TextBasic usage:fromchat_toolkitimportOpenAIChatBotfromchat_toolkitimportOrchestratorchat=Orchestrator(OpenAIChatBot())chat.terminal_conversation()Speech to TextBasic usage:fromchat_toolkitimportOpenAIChatBot,OpenAISpeechToTextfromchat_toolkitimportOrchestratorchat=Orchestrator(OpenAIChatBot(),OpenAISpeechToText())chat.terminal_conversation()Text to SpeechBasic usage:fromchat_toolkitimportOpenAIChatBot,Pyttsx3TextToSpeechfromchat_toolkitimportOrchestratorchat=Orchestrator(OpenAIChatBot(),text_to_speech_component=Pyttsx3TextToSpeech())chat.terminal_conversation()Speech to SpeechBasic usage:fromchat_toolkitimportOpenAIChatBot,OpenAISpeechToText,Pyttsx3TextToSpeechfromchat_toolkitimportOrchestratorchat=Orchestrator(OpenAIChatBot(),OpenAISpeechToText(),Pyttsx3TextToSpeech())chat.terminal_conversation()