This is a simple Python-based chatbot that uses the OpenAI API to interact with users. The chatbot takes user input, sends it to the OpenAI GPT model, and returns a response.
- Interact with the GPT-3.5-turbo model.
- Simple command-line interface.
- Continuously chat with the bot until the user decides to quit.
- Python 3.7 or higher
- OpenAI Python library
-
Clone the repository:
git clone https://github.com/your-username/openai-chatbot.git cd openai-chatbot
-
Install required packages:
pip install openai
-
Set up your OpenAI API key: Replace
"your open-ai-api-key"
in the code with your actual OpenAI API key. You can get your API key from the OpenAI Platform.
-
Run the chatbot:
python main.py
-
Interact with the chatbot:
- Type your message and press
Enter
. - To end the conversation, type
quit
,exit
, orbye
.
- Type your message and press
You: Hello
Chatbot: Hello! How can I assist you today?
You: What is the capital of France?
Chatbot: The capital of France is Paris.
You: bye
Chatbot: Goodbye! Have a great day!