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

openai

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultVisionModel     = openai.GPT4VisionPreview
	DefaultModel           = openai.GPT4TurboPreview
	DefaultPromptParameter = "defaultPromptParameter"
)

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(opts ...Options) (*Client, error)

func (*Client) Call

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

func (*Client) ListModules

func (c *Client) ListModules(ctx context.Context) (result []string, _ 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"`
	Cache      *cache.Client
}

type Status

type Status struct {
	CompletionID    string
	Request         any
	Response        any
	Cached          bool
	Chunks          any
	PartialResponse *types.CompletionMessage
}

Jump to

Keyboard shortcuts

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