client

package
v0.0.0-...-61616b3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Complete(ctx context.Context, latest []query.Message, content string) (*CompleteResult, error)
	Stream(ctx context.Context, latest []query.Message, content string) (*StreamResult, error)
	Update(opts ...Option)
}

func New

func New(apiKey string, opts ...Option) (Client, error)

type CompleteResult

type CompleteResult struct {
	Req      openai.ChatCompletionRequest
	Response openai.ChatCompletionResponse
}

type Option

type Option func(*client, *roundTripper)

func WithClientContext

func WithClientContext(clientContext int) Option

func WithModel

func WithModel(model string) Option

func WithRequestLogger

func WithRequestLogger(log log.Logger) Option

type StreamResult

type StreamResult struct {
	Req      openai.ChatCompletionRequest
	Response *openai.ChatCompletionStream
}

Jump to

Keyboard shortcuts

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