Documentation
¶
Index ¶
- Constants
- func Apply(o ...Opt) (*opts, error)
- type ClientOptFn
- type Opt
- func AddAny(key string, value any) Opt
- func AddFloat64(key string, value float64) Opt
- func AddString(key string, value ...string) Opt
- func AddUint(key string, value ...uint) Opt
- func ConvertOptsForClient(o *opts, provider string) ([]Opt, error)
- func Error(err error) Opt
- func NoOp() Opt
- func SetAny(key string, value any) Opt
- func SetBool(key string, value bool) Opt
- func SetFloat64(key string, value float64) Opt
- func SetString(key string, value string) Opt
- func SetUint(key string, value uint) Opt
- func WithClient(fn ClientOptFn) Opt
- func WithOpts(options ...Opt) Opt
- func WithProgress(fn ProgressFn) Opt
- func WithStream(fn StreamFn) Opt
- type Options
- type ProgressFn
- type StreamFn
Constants ¶
const ( ToolkitKey = "toolkit" ContentBlockKey = "content-block" ThinkingKey = "thinking" ThinkingBudgetKey = "thinking-budget" SystemPromptKey = "system" TemperatureKey = "temperature" TopPKey = "top-p" TopKKey = "top-k" MaxTokensKey = "max-tokens" StopSequencesKey = "stop-sequences" TaskTypeKey = "task-type" TitleKey = "title" OutputDimensionalityKey = "output-dimensionality" SeedKey = "seed" PresencePenaltyKey = "presence-penalty" FrequencyPenaltyKey = "frequency-penalty" JSONSchemaKey = "json-schema" AfterIdKey = "after-id" BeforeIdKey = "before-id" LimitKey = "limit" OffsetKey = "offset" ProviderKey = "provider" UserIdKey = "user-id" ServiceTierKey = "service-tier" CacheControlKey = "cache-control" OutputConfigKey = "output-config" ToolChoiceKey = "tool-choice" ToolChoiceNameKey = "tool-choice-name" MaxIterationsKey = "max-iterations" LabelKey = "label" )
Option keys used across providers
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientOptFn ¶
ClientOptFn is a function that receives a provider name and returns a provider-specific option. Used by agent-level option dispatchers to defer option resolution until the target provider is known.
type Opt ¶
type Opt func(*opts) error
A generic option type, which can set options on an agent or session
func AddAny ¶
AddAny appends a value to a typed slice for key. If the key does not exist, a new slice of the value's type is created. If the key exists, the existing value must be a slice of the same element type.
func AddFloat64 ¶
AddFloat64 appends a float64 value for key, preserving any existing values
func ConvertOptsForClient ¶
ConvertOptsForClient walks the accumulated client-aware options and resolves them against the given provider name, returning a flat slice of concrete Opts.
func SetFloat64 ¶
SetFloat64 sets a float64 value for key, replacing any existing values
func WithClient ¶
func WithClient(fn ClientOptFn) Opt
WithClient wraps a ClientOptFn so it can be stored among regular Opts. The returned Opt is a marker; it is not applied immediately. Instead, ConvertOptsForClient resolves it once the target provider is known.
func WithProgress ¶
func WithProgress(fn ProgressFn) Opt
WithProgress sets a progress callback function
func WithStream ¶
WithStream sets a streaming callback function. When set, generators that support streaming will deliver text chunks to fn as they arrive, rather than waiting for the complete response.
type Options ¶
type Options interface {
// Returns true if the key exists
Has(key string) bool
// Return a value for key, or nil
Get(key string) any
// Get a string value for key
GetString(key string) string
// Get a string array for key
GetStringArray(key string) []string
// Get a boolean value for key
GetBool(key string) bool
// Get a float64 value for key
GetFloat64(key string) float64
// Get a uint value for key
GetUint(key string) uint
// Return a set of keys as a url.Values
Query(keys ...string) url.Values
}
Options is the interface for accessing options
type ProgressFn ¶
ProgressFn is a callback function for progress updates status: descriptive status message (e.g., "downloading", "verifying") percent: progress percentage (0-100)