chatgpt

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...ai.ClientOption) (ai.AI, error)

func NewWithClient

func NewWithClient(client openai.Client, model string) ai.AI

Types

type ChatCompletionResponse added in v1.0.18

type ChatCompletionResponse interface {
	*openai.ChatCompletion | openai.ChatCompletionChunk
}

type ChatGPT

type ChatGPT struct {
	*openai.Client
	// contains filtered or unexported fields
}

func (*ChatGPT) Chat

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

func (*ChatGPT) ChatSession

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

func (*ChatGPT) ChatStream

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

func (*ChatGPT) Close added in v1.0.2

func (ai *ChatGPT) Close() error

func (ChatGPT) LLMs added in v1.0.6

func (ChatGPT) LLMs() ai.LLMs

func (*ChatGPT) Limit added in v1.0.17

func (chatgpt *ChatGPT) Limit() (rpm int64)

func (*ChatGPT) Model added in v1.0.10

func (chatgpt *ChatGPT) Model() string

func (*ChatGPT) SetCount

func (ai *ChatGPT) SetCount(i int64)

func (*ChatGPT) SetFunctionCall added in v1.0.19

func (chatgpt *ChatGPT) SetFunctionCall(f []ai.Function, mode ai.FunctionCallingMode)

func (*ChatGPT) SetJSONResponse added in v1.0.11

func (ai *ChatGPT) SetJSONResponse(set bool, schema *ai.JSONSchema)

func (*ChatGPT) SetLimit

func (chatgpt *ChatGPT) SetLimit(rpm int64)

func (*ChatGPT) SetMaxTokens

func (ai *ChatGPT) SetMaxTokens(i int64)

func (*ChatGPT) SetModel

func (ai *ChatGPT) SetModel(model string)

func (*ChatGPT) SetTemperature

func (ai *ChatGPT) SetTemperature(f float64)

func (*ChatGPT) SetTopP

func (ai *ChatGPT) SetTopP(f float64)

type ChatResponse

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

func (*ChatResponse[Response]) FunctionCalls added in v1.0.19

func (resp *ChatResponse[Response]) FunctionCalls() (res []ai.FunctionCall)

func (*ChatResponse[Response]) Raw added in v1.0.19

func (resp *ChatResponse[Response]) Raw() any

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

func (*ChatResponse[Response]) TokenCount added in v1.0.13

func (resp *ChatResponse[Response]) TokenCount() (res ai.TokenCount)

type ChatSession

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

func (*ChatSession) Chat

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

func (*ChatSession) ChatStream

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

func (*ChatSession) History

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

type ChatStream

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

func (*ChatStream) Close added in v1.0.2

func (cs *ChatStream) Close() error

func (*ChatStream) Next

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

Jump to

Keyboard shortcuts

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