This is a very basic Python bot that uses OpenAI API to query the PyTorch website. You can modify the script to query any other website. This is a very simple example just to get a taste of how easy it is to use OpenAI API. This example is inspired by the OpenAI documentation.
qa-bot-quick-demo.mov
- A GitHub Account
- An Open AI token (can be obtained in your Open AI Account Settings)
-
Fork this repo by clicking Fork in the upper-right corner of the home page.
-
One your computer, open a terminal.
-
Clone your fork to your computer by running:
If you are using SSH:
git clone [email protected]:<path to your fork>.git
If you are using HTTPs:
git clone https://github.com/<path-to-your-fork>.git
-
Change directory to your fork:
cd path-to-your-fork
-
Open the script file for editing, for example using
vim
:vi qa-bot-test.py
-
In the script, replace
YOUR_API_KEY
with the token you have obtained from your OpenAI account. -
Save the file:
:x!
-
Run the script:
python3 qa-bot-test.py
Response:
What would you like to learn? (type "exit" to quit):
- Type your question and receive an answer. For example: How to install PyTorch?
- To terminate the bot, type
exit
.
openai.error.RateLimitError: You exceeded your current quota, please check your plan and billing details.
If you see the error above, it means exactly that - you have execeed your current limit and need to either wait or upgrade your account.