Skip to content

This project demonstrates the use of OpenAI's GPT-3.5-turbo model to create a simple chatbot

Notifications You must be signed in to change notification settings

kocsisbalazs/gpt-3.5-api-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

OpenAI API Chatbot with GPT-3.5-turbo

Table of Contents

  1. Introduction
  2. OpenAI API
  3. Code Explanation
  4. Usage

Introduction

This project demonstrates the use of OpenAI's GPT-3.5-turbo model to create a simple chatbot. The chatbot interacts with users, responds to their messages, and holds conversations just like in the original site.

OpenAI API

OpenAI is a company that provides powerful natural language processing models, including GPT-3.5-turbo. The OpenAI API allows developers to integrate these models into their applications, enabling them to understand and generate human-like text.

Code Explanation

  1. The code in this project is a Python script that uses the OpenAI API to interact with the GPT-3.5-turbo model.
  2. The code initializes the OpenAI API key, defines a function chatGPT, and sets up a conversation loop with the chatbot.
  3. The chatGPT function sends a user's message. To structure messages as a conversation, In this case, we have a list of messages, each with a "role" ("user" or "assistant") and "content" (the text of the message). This allows the model to understand the context and provide context-aware responses.

Usage

  1. Obtain an OpenAI API key: You'll need to sign up for OpenAI and get your API key. Replace "YOUR_API_KEY_HERE" in the code with your actual key.
  2. Install required packages: You might need to install the openai package. You can do this using pip install openai.
  3. Run the script: Execute the Python script. The chatbot will engage in conversations with users.

About

This project demonstrates the use of OpenAI's GPT-3.5-turbo model to create a simple chatbot

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages