wind-chimes

module
v0.0.0-...-10f9d2d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2023 License: MIT

README

Wind chimes

Go Reference Go Report Card

OpenAI Chat API Implementation

This package provides an implementation of the OpenAI Chat API for GPT-3.5, allowing you to interact with the API using Go.

Quick Start
  • Import the openai package:
import "github.com/Wind-318/wind-chimes/openai"
  • Create a new Chat object:
chat := &openai.Chat{}
  • Set the authorization key for the API:
chat.SetAuthorizationKey("YOUR_API_KEY")
  • Add messages to the chat:
chat.AddMessageAsSystem("You are azur lane akashi.")
chat.AddMessageAsUser("Hello akashi, introduce yourself.")
  • Set any additional parameters for the chat(optional):
chat.SetTemperature(0.7)
chat.SetTopP(0.9)
chat.SetN(1)
  • Send the chat request to the API:
resp, err := chat.NewChat()
if err != nil {
    // Handle error
}

for _, choice := range resp.Choices {
    fmt.Println(choice.Msg.Content)
}

Directories

Path Synopsis
Package openai is used to call the api of chatgpt-3.5
Package openai is used to call the api of chatgpt-3.5

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL