Help us shape the future of Go! Take the 2026 Go Developer Survey

openai

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultModel    = openai.GPT4o
	BuiltinCredName = "sys.openai"
	TooLongMessage  = "Error: tool call output is too long"
)
View Source
const DefaultMaxTokens = 400_000 // This is the limit for GPT-5
View Source
const WaitingMessage = "Waiting for model response..."

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(ctx context.Context, credStore credentials.CredentialStore, opts ...Options) (*Client, error)

func (*Client) Call

func (c *Client) Call(ctx context.Context, messageRequest types.CompletionRequest, env []string, status chan<- types.CompletionStatus) (*types.CompletionMessage, error)

func (*Client) ListModels added in v0.1.4

func (c *Client) ListModels(ctx context.Context, providers ...string) ([]openai.Model, error)

func (*Client) ProxyInfo added in v0.9.5

func (c *Client) ProxyInfo([]string) (token, urlBase string)

func (*Client) RetrieveAPIKey added in v0.8.0

func (c *Client) RetrieveAPIKey(ctx context.Context, env []string) error

func (*Client) Supports added in v0.3.0

func (c *Client) Supports(ctx context.Context, modelName string) (bool, error)

func (*Client) ValidAuth added in v0.3.0

func (c *Client) ValidAuth() error

type InvalidAuthError added in v0.8.0

type InvalidAuthError struct{}

func (InvalidAuthError) Error added in v0.8.0

func (InvalidAuthError) Error() string

type Options

type Options struct {
	BaseURL      string `usage:"OpenAI base URL" name:"openai-base-url" env:"OPENAI_BASE_URL"`
	APIKey       string `usage:"OpenAI API KEY" name:"openai-api-key" env:"OPENAI_API_KEY"`
	OrgID        string `usage:"OpenAI organization ID" name:"openai-org-id" env:"OPENAI_ORG_ID"`
	DefaultModel string `usage:"Default LLM model to use" default:"gpt-4o"`
	ConfigFile   string `usage:"Path to GPTScript config file" name:"config"`
	SetSeed      bool   `usage:"-"`
	CacheKey     string `usage:"-"`
	Cache        *cache.Client
}

func Complete added in v0.8.2

func Complete(opts ...Options) (result Options)

Jump to

Keyboard shortcuts

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