Documentation
¶
Index ¶
- type ModelOptions
- func (c *ModelOptions) Gateway() string
- func (c *ModelOptions) GeneratingTitle() bool
- func (c *ModelOptions) MaxTokens() int64
- func (c *ModelOptions) ModelsDevStore() *modelsdev.Store
- func (c *ModelOptions) NoThinking() bool
- func (c *ModelOptions) Providers() map[string]latest.ProviderConfig
- func (c *ModelOptions) StructuredOutput() *latest.StructuredOutput
- func (c *ModelOptions) TransportWrapper() func(http.RoundTripper) http.RoundTripper
- type Opt
- func FromModelOptions(m ModelOptions) []Opt
- func WithGateway(gateway string) Opt
- func WithGeneratingTitle() Opt
- func WithHTTPTransportWrapper(fn func(base http.RoundTripper) http.RoundTripper) Opt
- func WithMaxTokens(maxTokens int64) Opt
- func WithModelsDevStore(store *modelsdev.Store) Opt
- func WithNoThinking() Opt
- func WithProviders(providers map[string]latest.ProviderConfig) Opt
- func WithStructuredOutput(structuredOutput *latest.StructuredOutput) Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ModelOptions ¶
type ModelOptions struct {
// contains filtered or unexported fields
}
func (*ModelOptions) Gateway ¶
func (c *ModelOptions) Gateway() string
func (*ModelOptions) GeneratingTitle ¶
func (c *ModelOptions) GeneratingTitle() bool
func (*ModelOptions) MaxTokens ¶
func (c *ModelOptions) MaxTokens() int64
func (*ModelOptions) ModelsDevStore ¶ added in v1.59.0
func (c *ModelOptions) ModelsDevStore() *modelsdev.Store
func (*ModelOptions) NoThinking ¶ added in v1.35.0
func (c *ModelOptions) NoThinking() bool
func (*ModelOptions) Providers ¶
func (c *ModelOptions) Providers() map[string]latest.ProviderConfig
func (*ModelOptions) StructuredOutput ¶
func (c *ModelOptions) StructuredOutput() *latest.StructuredOutput
func (*ModelOptions) TransportWrapper ¶ added in v1.79.0
func (c *ModelOptions) TransportWrapper() func(http.RoundTripper) http.RoundTripper
TransportWrapper returns the HTTP transport wrapper function registered via WithHTTPTransportWrapper, or nil if none was set.
type Opt ¶
type Opt func(*ModelOptions)
func FromModelOptions ¶
func FromModelOptions(m ModelOptions) []Opt
FromModelOptions converts a concrete ModelOptions value into a slice of Opt configuration functions. Later Opts override earlier ones when applied.
func WithGateway ¶
func WithGeneratingTitle ¶
func WithGeneratingTitle() Opt
func WithHTTPTransportWrapper ¶ added in v1.79.0
func WithHTTPTransportWrapper(fn func(base http.RoundTripper) http.RoundTripper) Opt
WithHTTPTransportWrapper registers a function that wraps the HTTP transport used by provider clients (Anthropic, OpenAI, and Gemini with the Gemini API backend). The function receives the transport that docker-agent built (including OTel instrumentation, SSE decompression fix, and Desktop proxy support) and must return a new RoundTripper that delegates to it. The wrapper is applied in both direct mode and gateway/proxy mode.
Call-frequency note: in direct mode the wrapper is invoked once at client construction time; in gateway mode it is invoked on every LLM request (because gateway clients are rebuilt on each call to refresh short-lived auth tokens). Wrappers with per-call side effects (metrics, token rotation) will therefore be called more frequently in gateway mode.
Limitations:
- OpenAI clients configured with transport=websocket bypass the HTTP transport layer entirely; the wrapper is not applied in that mode.
- Gemini clients using the Vertex AI backend (project/location config or GOOGLE_GENAI_USE_VERTEXAI) rely on the genai SDK's default HTTP client; the wrapper is not applied and a warning is logged.
The wrapper function must return a non-nil RoundTripper; returning nil is a no-op (a warning is logged and the original transport is kept).
Example — inject a bearer token on every outbound LLM request:
options.WithHTTPTransportWrapper(func(base http.RoundTripper) http.RoundTripper {
return &bearerTransport{token: myToken, base: base}
})
func WithMaxTokens ¶
func WithModelsDevStore ¶ added in v1.59.0
func WithNoThinking ¶ added in v1.35.0
func WithNoThinking() Opt
func WithProviders ¶
func WithProviders(providers map[string]latest.ProviderConfig) Opt
func WithStructuredOutput ¶
func WithStructuredOutput(structuredOutput *latest.StructuredOutput) Opt