Skip to content

AlvinIsac/OpenApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Customized Chatbot with OpenAI API

This project is a simple chatbot that leverages the OpenAI API to generate conversational responses based on user inputs and maintains conversation history for contextual relevance.

Features

  • Uses OpenAI's API to generate responses with context retention.
  • Configuration options for model selection, response creativity, and token length.
  • Secure handling of API keys through environment variables.
  • Terminal-based interface for user interaction.

Prerequisites

Ensure you have the following installed:

  • Python 3
  • Virtual environment
  • OpenAI API key

Installation

  1. Clone the repository:

    git clone https://github.com/AlvinIsac/OpenApi.git
  2. Navigate to the project directory:

    cd OpenApi
  3. Install the required dependencies:

    pip install -r requirements.txt
  4. Create a .env file in the project directory and add your OpenAI API key:

    OPENAI_API_KEY= <open_api_key>

    Note: You can purchase a new one from OpenAI's Platform.

Usage

  1. Run the chatbot script:

    python chatbot.py
  2. Interact with the chatbot by typing messages and you can also customise it for your needs. Type exit to end the conversation.

Configuration

  • model: Specifies the OpenAI model to use (default: gpt-4o-mini).
  • temperature: Controls response creativity (default: 0.7).
  • max_tokens: Sets the maximum length of responses (default: 100 tokens).

About

Chatbot using the OpenAi Api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages