openai

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultModel = openai.GPT4TurboPreview
)

Variables

This section is empty.

Functions

func GetAzureMapperFunction added in v0.1.5

func GetAzureMapperFunction(defaultModel, azureModel string) func(string) string

Types

type Client

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

func NewClient

func NewClient(opts ...Options) (*Client, error)

func (*Client) Call

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

func (*Client) ListModels added in v0.1.4

func (c *Client) ListModels(ctx context.Context, providers ...string) (result []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 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"`
	APIVersion   string         `usage:"OpenAI API Version (for Azure)" name:"openai-api-version" env:"OPENAI_API_VERSION"`
	APIType      openai.APIType `usage:"OpenAI API Type (valid: OPEN_AI, AZURE, AZURE_AD)" name:"openai-api-type" env:"OPENAI_API_TYPE"`
	OrgID        string         `usage:"OpenAI organization ID" name:"openai-org-id" env:"OPENAI_ORG_ID"`
	DefaultModel string         `usage:"Default LLM model to use" default:"gpt-4-turbo-preview"`
	SetSeed      bool           `usage:"-"`
	CacheKey     string         `usage:"-"`
	Cache        *cache.Client
}

Jump to

Keyboard shortcuts

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