This repository contains a simple chatbot application that uses the OpenAI GPT-4 model to generate responses based on user input. The project leverages the openai
Python package and uses a .env
file to securely manage API keys.
-
Clone the repository:
git clone https://github.com/yourusername/0.28-openAI-python-template.git cd 0.28-openAI-python-template
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Create a
.env
file in the root directory of the project and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key_here
-
Add your system prompt to a
system_training.txt
file in the root directory of the project. -
Run the chatbot:
python chatbot.py
-
Enter your message when prompted in the console.
0.28-openAI-python-template/ ├── chatbot.py ├── requirements.txt ├── .env └── system_training.txt
chatbot.py
: Main script to run the chatbot.requirements.txt
: Contains the list of dependencies..env
: Contains environment variables like the OpenAI API key.system_training.txt
: Contains the system prompt.
- API Key: Store your OpenAI API key in the
.env
file as shown above. - System Prompt: Customize your system prompt in the
system_training.txt
file.
Contributions are welcome! Please feel free to submit a Pull Request or open an issue to discuss changes.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed under the MIT License. See the LICENSE file for more details.