Git Product home page Git Product logo

openai-gpt3-chatbot-master's Introduction

OpenAI GPT-3 Chatbot

GitHub Actions Build Status

A simple interface to the OpenAI GPT-3 models with speech to text for input and text to speech for the output from OpenAI.

Setup

Optionally create a new Python environment and active it:

# create a new environment in the current directory called env
python3 -m venv env

# activate the environment
source env/bin/activate

Install dependencies:

# Mac OSX
brew install portaudio
brew link portaudio

# save the output of this command
brew --prefix portaudio

Run

sudo vi $HOME/.pydistutils.cfg

and paste the following text replacing the values with the output saved from above:

[build_ext]
include_dirs=<PATH FROM STEP 3>/include/
library_dirs=<PATH FROM STEP 3>/lib/

Finally, run the following to install all required Python packages:

pip install -e .

Running the Script

python gpt3_assistant/main.py --log-level=INFO --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" to stop the application.

Optional: Specifying an Output Language Accent

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

python gpt3_assistant/main.py --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

Linting

Sort all imports with:

isort --multi-line 3 --profile black --python-version 38 gpt3_assistant

Run black gpt3_assistant to automatically reformat all source files based on the default configuration.

Testing

Unit Tests

Run pytest to run all unit tests.

Coverage Report

Get the coverage with:

coverage run -m pytest tests

View the coverage report:

coverage report --fail-under=90 --include="gpt3_assistant/*"

References

SpeechRecognition library docs

Google Translate Text-to-Speech API (gTTS)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.