chatgpt

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(authToken string) ai.AI

func NewWithBaseURL added in v1.0.3

func NewWithBaseURL(authToken, baseURL string) ai.AI

func NewWithClient

func NewWithClient(client *openai.Client) ai.AI

Types

type ChatGPT

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

func (*ChatGPT) Chat

func (ai *ChatGPT) Chat(ctx context.Context, messages ...string) (ai.ChatResponse, error)

func (*ChatGPT) ChatSession

func (ai *ChatGPT) ChatSession() ai.ChatSession

func (*ChatGPT) ChatStream

func (ai *ChatGPT) ChatStream(ctx context.Context, messages ...string) (ai.ChatStream, error)

func (*ChatGPT) Close added in v1.0.2

func (ai *ChatGPT) Close() error

func (*ChatGPT) SetCount

func (ai *ChatGPT) SetCount(i int32)

func (*ChatGPT) SetLimit

func (chatgpt *ChatGPT) SetLimit(limit rate.Limit)

func (*ChatGPT) SetMaxTokens

func (ai *ChatGPT) SetMaxTokens(i int32)

func (*ChatGPT) SetModel

func (ai *ChatGPT) SetModel(model string)

func (*ChatGPT) SetTemperature

func (ai *ChatGPT) SetTemperature(f float32)

func (*ChatGPT) SetTopP

func (ai *ChatGPT) SetTopP(f float32)

type ChatGPTResponse

type ChatGPTResponse interface {
	openai.ChatCompletionResponse | openai.ChatCompletionStreamResponse
}

type ChatResponse

type ChatResponse[Response ChatGPTResponse] struct {
	// contains filtered or unexported fields
}

func (*ChatResponse[Response]) Results

func (resp *ChatResponse[Response]) Results() (res []string)

func (*ChatResponse[Response]) String added in v1.0.2

func (resp *ChatResponse[Response]) String() string

type ChatSession

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

func (*ChatSession) Chat

func (session *ChatSession) Chat(ctx context.Context, messages ...string) (ai.ChatResponse, error)

func (*ChatSession) ChatStream

func (session *ChatSession) ChatStream(ctx context.Context, messages ...string) (ai.ChatStream, error)

func (*ChatSession) History

func (session *ChatSession) History() (history []ai.Message)

type ChatStream

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

func (*ChatStream) Close added in v1.0.2

func (stream *ChatStream) Close() error

func (*ChatStream) Next

func (stream *ChatStream) Next() (ai.ChatResponse, error)

Jump to

Keyboard shortcuts

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