Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Call(ctx context.Context, messageRequest types.CompletionRequest, env []string, ...) (*types.CompletionMessage, error)
- func (c *Client) ListModels(ctx context.Context, providers ...string) ([]openai.Model, error)
- func (c *Client) ProxyInfo([]string) (token, urlBase string)
- func (c *Client) RetrieveAPIKey(ctx context.Context, env []string) error
- func (c *Client) Supports(ctx context.Context, modelName string) (bool, error)
- func (c *Client) ValidAuth() error
- type InvalidAuthError
- type Options
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 ¶
View Source
var ErrNoVisibleOutput = errors.New("the model produced no answer in time")
ErrNoVisibleOutput is returned when a stream keeps delivering data but no text or tool call for longer than the first-output timeout. Reasoning deltas are not part of the answer, so a model caught in a reasoning loop looks alive to the idle timeout while the user sees nothing.
View Source
var ErrStreamIdle = errors.New("the model stopped sending output; the response is incomplete")
ErrStreamIdle is returned when a streamed completion delivers no data for longer than the idle timeout. Without it a silent upstream holds the run until the run-level timeout.
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 ¶
func (*Client) RetrieveAPIKey ¶
type InvalidAuthError ¶
type InvalidAuthError struct{}
func (InvalidAuthError) Error ¶
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
}
Click to show internal directories.
Click to hide internal directories.