Skip to content

A simple Python chatbot that interacts with OpenAI's GPT-4 model through the command line. The application allows users to have conversations with the AI model using their OpenAI API key

Notifications You must be signed in to change notification settings

PatrykIA/OpenAI_GPT4_Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI Chat Bot

A simple Python chatbot that uses OpenAI's API to interact with GPT models

Requirements

- Python 3.12 or newer
- OpenAI API key

Installation

  1. Clone the repository:
git clone https://github.com/PatrykIA/OpenAI_GPT4_Python
cd REPO_NAME
  1. Install required dependencies:
pip install -r requirements.txt
  1. Configure environment variables:
    • Copy .env.example to .env
    • Open .env file and enter your OpenAI API key

Environment Variables

Create a `.env` file in the root directory with the following variable:

OPENAI_API_KEY=your_api_key_here

Usage

Run the application using:

python main.py

The chatbot will:

  1. Start a conversation
  2. Accept user input
  3. Generate responses using GPT-4
  4. Continue until you type 'quit', 'exit', or 'bye'

Project Structure

Project Structure

├── main.py             # Main application file
├── .env                # Environment variables (not tracked in git)
├── .env.example        # Example environment variables 
├── .gitignore          # Git ignore file
├── README.md           # This file
└── requirements.txt    # Project dependencies

Contributing

Feel free to submit issues and enhancement requests.

Author

Patryk Rogowski / PatrykIA

Acknowledgments

  • OpenAI for providing the GPT API

About

A simple Python chatbot that interacts with OpenAI's GPT-4 model through the command line. The application allows users to have conversations with the AI model using their OpenAI API key

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages