This is a simple Q&A-style chatbot illustrating how easy it is to access the power of GPT-3's API from applications written in Python.
Follow these steps to get it up and running:
-
Create an OpenAI account: https://beta.openai.com/signup
-
Create a new Python conda environment for your GPT-3 project
-
Activate the new conda environment
-
Install OpenAI's Python Library: pip install --upgrade openai
-
Install python-dotenv: conda install -c conda-forge python-dotenv
-
Clone this GitHub repo
-
Create an .env file in your clone of the repo (accessing your API key from an .env file is more secure than hardcoding it within your .py file)
-
Retrieve your API key: https://beta.openai.com/account/api-keys
-
Add this line to your .env file: OPENAI_API_KEY = the-secret-api-key-you-just-retrieved
-
Save the .env file
-
Run the code in quick-and-dirty_gpt-3_q&a_bot.py