gpt

package
v0.0.0-...-3f5de73 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AssistantID string
View Source
var AssistantVersion string

Functions

This section is empty.

Types

type Client

type Client interface {
	GetCompletion(systemPrompt string, userPrompt string) (string, error)
	GetEmbedding(text string) ([]float32, error)
	CreateThread() (string, error)
	AddMessage(threadID string, content string) error
	RunThread(threadID string) (chan string, error)
}

type OpenAIClient

type OpenAIClient struct {
	// contains filtered or unexported fields
}

func NewOpenAIClient

func NewOpenAIClient(conf *config.Config) *OpenAIClient

func (*OpenAIClient) AddMessage

func (c *OpenAIClient) AddMessage(threadID string, content string) error

AddMessage adds a message to a previously created thread in the OpenAI API.

func (*OpenAIClient) CreateRun

func (c *OpenAIClient) CreateRun(threadID string) (io.ReadCloser, error)

CreateRun starts a new run in a previously created thread in the OpenAI API, and returns a channel that will receive the response content in string chunks.

func (*OpenAIClient) CreateThread

func (c *OpenAIClient) CreateThread() (string, error)

CreateThread creates a new thread in the OpenAI API and returns the thread ID.

func (*OpenAIClient) GetCompletion

func (c *OpenAIClient) GetCompletion(systemPrompt string, userPrompt string) (string, error)

func (*OpenAIClient) RunThread

func (c *OpenAIClient) RunThread(threadID string, responseChan chan<- string)

Jump to

Keyboard shortcuts

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