A simple command line chatbot with GPT-4.
You need to create a virtual env and install the packages listed in requirements.txt
. You can then run Jupyter Notebooks in VS Code.
Follow these steps: How to Work with Python Virtual Environments, Jupyter Notebooks and VS Code.
You need to create a .env
file with your OPENAI_API_KEY
.
To run the CLI:
cd 02-gpt-4-chatbot
python3 chatbot.py
You can define the personality of your chatbot, it is friendly and helpful by default:
python3 chatbot.py --personality "funny"
You can quit by typing ctrl + C
(Mac) or cmd + C
(Windows).
- writing the basic chatbot structure.
- persisting messages accross requests.
- adding optional personalities.
- colorizing the chatbot output.
Based on Mastering OpenAI Python APIs: Unleash the Power of GPT4 by Colt Steele (2023).