/openai-chat-endpoint-boilerplate

Console based chat application boilerplate for gpt-3.5-turbo and gpt-4 model

Primary LanguagePython

GPT-3.5-Turbo / GPT-4 Chatbot Boilerplate

This repository contains a simple Python-based boilerplate code for using OpenAI's GPT-3.5-turbo and GPT-4 model to create a chatbot. This chatbot utilizes the OpenAI API and Tiktoken library to manage tokens and costs.

Getting Started

Before you can use this boilerplate, you'll need to set up a few things:

  1. Sign up for an OpenAI account and obtain an API key.
  2. Install the required Python libraries by running pip install openai tiktoken python-dotenv.

Usage

  1. Clone this repository:

    git clone https://github.com/lablab-ai/openai-chat-endpoint-boilerplate.git
    cd openai-chat-endpoint-boilerplate
    
  2. Create a .env file in the root directory of the project and add your OpenAI API key:

    OPENAI_API_KEY=your_openai_api_key
    
  3. Run the chatbot script:

    python openai-chat-endpoint-boilerplate.py
    
  4. Start chatting with the bot by running the openai-chat-endpoint-boilerplate.py file


Artificial Intelligence Hackathons, tutorials and Boilerplates

Join the LabLab Discord

Discord Banner 1
On lablab discord, we discuss this repo and many other topics related to artificial intelligence! Checkout upcoming Artificial Intelligence Hackathons Event

Acclerating innovation through acceleration