This repository contains code for building a terminal-based chatbot using OpenAI’s recently released ChatGPT API Released on 01/03/2023. The code is written in Python and uses the OpenAI Python library
Before you begin, you’ll need to sign up for an OpenAI API key. You can sign up here and get your API key here.
Once you have your API key, you can install the openai library using pip:
pip install openai
You will need to replace the API Key in the code in order to run the chatbot
openai.api_key
with your API key, in the file chat.py
line 3To start the chatbot, run the following command:
python chat.py
You can enter your prompts and the chatbot will generate responses. It will continue to respond until you enter the message exit
to exit the program. You can also enter clear
to clear the chat history and start a new conversation.
Happy chatting 🎉
Name: Abdur Rahman
Institution: Indian Institute of Technology Delhi
Find me on: