This is a simple AI-powered chatbot built using Python and the OpenAI API. It takes user input and returns an AI-generated response using GPT models.
- OpenAI Chat Completion integration
- Secure API key handling with
.env - Virtual environment setup with
venv - Supports both GPT-4o and GPT-3.5-turbo models
bash git clone https://github.com/faithchris/openai-chatbot.git cd openai-chatbot
bash python3 -m venv venv source venv/bin/activate
After activating your virtual environment, install the required Python packages using pip:
bash pip install -r requirements.txt
Create a .env file in the root directory and add your OpenAI API key:
env OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Once everything is set up, you can run the chatbot using:
bash python chatt.py