client

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Clients []*Ref

Functions

func Init

func Init() error

Types

type Client

type Client struct {
	*Ref

	Samples *Samples
	// contains filtered or unexported fields
}

func Get

func Get(ref *Ref) *Client

func (*Client) Completion

func (c *Client) Completion(ctx context.Context, params openai.ChatCompletionNewParams) (
	*openai.ChatCompletion, error,
)

func (Client) GetModel

func (c Client) GetModel(ctx context.Context, tier ModelTier) string

type ModelTier

type ModelTier int
const (
	Tier1 ModelTier = iota + 1
)

type Ref

type Ref struct {
	Config *config.Profile
	Client *openai.Client
}
var Default *Ref

func GetDefaultClient

func GetDefaultClient() *Ref

GetClient gets the default client to use outside of the chat context where user can pick the client explicitly.

func (*Ref) Request

func (c *Ref) Request(ctx context.Context, cb RequestCallback) error

type RequestCallback

type RequestCallback func(client *openai.Client) error

type Samples

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

Samples implements a cheesy way to estimate the number of bytes per token registered through several calls to the LLM service.

func (*Samples) BytesPerTok

func (s *Samples) BytesPerTok() float32

Jump to

Keyboard shortcuts

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