Skip to content

garydevenay/go-chatgpt-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoDoc

ChatGPT

A simple, developer-friendly Go package for interacting with the OpenAI ChatGPT API.

Features

  • Easy-to-use API client for sending messages to ChatGPT
  • Supports both "gpt-3.5-turbo" and "gpt-4" models
  • Clear documentation and error messages

Installation

go get -u github.com/garydevenay/go-chatgpt-client

Usage

First, import the package:

import "github.com/garydevenay/go-chatgpt-client"

Then, create a new ChatGPT client with your API key:

client := chatgpt.NewClient("your-api-key")

Now you can send messages to the ChatGPT API:

messages := []chatgpt.Message{
    {Role: "system", Content: "You are a helpful assistant."},
    {Role: "user", Content: "What is the capital of France?"},
}

response, err := client.SendMessage("gpt-3.5-turbo", messages)
if err != nil {
    log.Fatal(err)
}

fmt.Println(response)

You can use the same client to send more messages and have an interactive conversation with ChatGPT.

Documentation

For detailed information about the ChatGPT API, structs, and functions, see the Godoc Documentation.

License MIT

About

A Golang client for the OpenAI ChatGPT API, providing a simple and efficient way to interact with GPT-3.5-turbo and GPT-4 models.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages