Skip to main content

Package to speak with OpenAI's GPT models

Project description

ChatGPT Voice Assistant

GitHub Actions Build Status

A simple interface to the OpenAI ChatGPT model with speech to text for input and text to speech for the output. chatgpt-voice-assistant uses OpenAI Whisper for speech transcription and OpenAI Speech Generation for TTS.

Setup

Mac Prerequisites

Install dependencies:

brew install portaudio
brew link portaudio

Update your pydistutils config file for portaudio usage by running the following:

echo "[build_ext]" >> $HOME/.pydistutils.cfg
echo "include_dirs="`brew --prefix portaudio`"/include/" >> $HOME/.pydistutils.cfg
echo "library_dirs="`brew --prefix portaudio`"/lib/" >> $HOME/.pydistutils.cfg

Install from PyPI

Run the following to install the chatgpt-assist CLI application:

pip install chatgpt-voice-assistant

Install from Source

  1. Install poetry (official docs or with pip install poetry)
  2. Install all dependencies with poetry install

Running the Script

Either set the OPENAI_API_KEY environment variable before running the script or pass in your secret key to the script like in the example below:

export OPENAI_API_KEY=<OPEN API SECRET KEY HERE>
gptassist

# OR

gptassist --open-ai-key=<OPEN API SECRET KEY HERE>

or if installed from source with poetry:

poetry run gptassist --open-ai-key=<OPEN API SECRET KEY HERE>

Start speaking and turn up your volume to hear the AI assistant respond.

Say the word "exit" or hit Ctrl+C in your terminal to stop the application.

Options

Below is the help menu from the chatgpt-assist CLI detailing all available options:

-h, --help
    show this help message and exit

--log-level LOG_LEVEL
    Whether to print at the debug level or not.

--input-device-name INPUT_DEVICE_NAME
    The input device name.

--lang LANG
    The language to listen for when running speech to text (ex. en or fr).

--max-tokens MAX_TOKENS
    Max OpenAI completion tokens to use for text generation.

--tld TLD
    Top level domain (ex. com or com.au).

--safe-word SAFE_WORD
    Word to speak to exit the application.

--wake-word WAKE_WORD
    (Optional) Word to trigger a response.

--open-ai-key OPEN_AI_KEY
    Required. Open AI Secret Key (or set OPENAI_API_KEY environment variable)

--tts {apple,google,openai}
    Choose a text-to-speech engine.

--speech-rate SPEECH_RATE
    The rate at which to play speech. 1.0=normal

Specifying an Output Language Accent

Specify both the LANGUAGE and TOP_LEVEL_DOMAIN vars to override the default English (United States)

gptassist --open-ai-key=<OPENAI_KEY> --lang=en --tld=com

Language Examples

  • English (United States) DEFAULT
    • LANGUAGE=en TOP_LEVEL_DOMAIN=com
  • English (Australia)
    • LANGUAGE=en TOP_LEVEL_DOMAIN=com.au
  • English (India)
    • LANGUAGE=en TOP_LEVEL_DOMAIN=co.in
  • French (France)
    • LANGUAGE=fr TOP_LEVEL_DOMAIN=fr

See Localized 'accents' section on gTTS docs for more information

References

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

chatgpt_voice_assistant-2.0.1.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

chatgpt_voice_assistant-2.0.1-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file chatgpt_voice_assistant-2.0.1.tar.gz.

File metadata

  • Download URL: chatgpt_voice_assistant-2.0.1.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for chatgpt_voice_assistant-2.0.1.tar.gz
Algorithm Hash digest
SHA256 2f533eef5f2704059885e52672e3eb063b4f21e073bd687f936affeb760548fd
MD5 5cebd61190f28ccdbe2d9244fb6cae91
BLAKE2b-256 0f4ec19ed1c6433245e326b7b4e787bd7f4c42d89ffdb089c83df73bfc163f55

See more details on using hashes here.

File details

Details for the file chatgpt_voice_assistant-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for chatgpt_voice_assistant-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3539998cae14e61979e496dd774d8253d01d71991706d8e23a020816821d077e
MD5 6e71137b868423de9689ece06a8e7bda
BLAKE2b-256 6b8e6785c2d64ec5bc46116472745ae47f93e652324eda380c6976014904fd8b

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