Documentation
¶
Index ¶
- Constants
- func CatalogModels(infos []ai.ModelInfo) []config.ModelInfoLite
- func ClientForProvider(prov config.Provider, name string, maxRetries int) (ai.Client, error)
- func ClientForProviderContext(ctx context.Context, prov config.Provider, name string, maxRetries int) (ai.Client, error)
- func ClientForProviderOptional(prov config.Provider, name string, maxRetries int) (ai.Client, error)
- func ClientForProviderOptionalContext(ctx context.Context, prov config.Provider, name string, maxRetries int) (ai.Client, error)
- func DefaultEffortFor(catalogs map[string]config.Catalog, provName, modelID, pinned string) string
- func RefreshCatalogs(cfg *config.Config, force bool) map[string]config.Catalog
- func RefreshCatalogsContext(parent context.Context, cfg *config.Config, force bool) map[string]config.Catalog
- func ResetFailoverBreakers()
- func ResolveWithRefresh(cfg *config.Config, modelName, provName string) (config.Provider, config.Model, string, error)
- func ResolveWithRefreshContext(ctx context.Context, cfg *config.Config, modelName, provName string) (config.Provider, config.Model, string, error)
- func ResolvedProvider(cfg *config.Config, model, prov string) string
- func SelectionNames(cfg *config.Config, mdl config.Model, modelName, provName string) (string, string)
- func SubModelFor(cfg *config.Config, model, provider string) (agent.SubModel, error)
- func SubModelForContext(ctx context.Context, cfg *config.Config, model, provider string) (agent.SubModel, error)
- func SupportsVision(cfg *config.Config, modelName, modelID string, ...) bool
- func TaskDefaultFor(cfg *config.Config) (agent.SubModel, error)
- func TaskDefaultForContext(ctx context.Context, cfg *config.Config) (agent.SubModel, error)
- func TokenLimits(mdl config.Model, cat config.Catalog, apiID string) (contextLimit, maxOut int)
- type FailoverClient
- func (c *FailoverClient) Clone() ai.Client
- func (c *FailoverClient) Complete(ctx context.Context, req ai.Request) (string, ai.Usage, error)
- func (c *FailoverClient) Endpoint() string
- func (c *FailoverClient) Models(ctx context.Context) ([]ai.ModelInfo, error)
- func (c *FailoverClient) SetCacheKey(key string)
- func (c *FailoverClient) SetOnRetry(fn func(ai.RetryEvent))
- func (c *FailoverClient) Stream(ctx context.Context, req ai.Request, onText, onThink func(string), ...) (ai.Message, ai.Usage, error)
- func (c *FailoverClient) SupportsNativeWebSearch() bool
- type FailoverConfig
- type FailoverSettings
- type RetryPolicy
- type Route
- func ResolveFailoverRouteContext(ctx context.Context, cfg *config.Config, modelName, providerName string, ...) (Route, error)
- func ResolveRoute(cfg *config.Config, modelName, providerName string, optional bool) (Route, error)
- func ResolveRouteContext(ctx context.Context, cfg *config.Config, modelName, providerName string, ...) (Route, error)
Constants ¶
const ( DefaultStreamAttempts = 6 DefaultMaxSwitches = 3 DefaultFailureThreshold = 4 DefaultCooldown = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func CatalogModels ¶
func CatalogModels(infos []ai.ModelInfo) []config.ModelInfoLite
func ClientForProvider ¶
func ClientForProviderContext ¶ added in v0.103.0
func ClientForProviderOptionalContext ¶ added in v0.103.0
func DefaultEffortFor ¶
func RefreshCatalogs ¶
func RefreshCatalogsContext ¶ added in v0.103.0
func ResetFailoverBreakers ¶ added in v0.107.0
func ResetFailoverBreakers()
func ResolveWithRefresh ¶
func ResolveWithRefreshContext ¶ added in v0.103.0
func SelectionNames ¶
func SubModelFor ¶
func SubModelForContext ¶ added in v0.103.0
func SupportsVision ¶ added in v0.103.0
func SupportsVision(cfg *config.Config, modelName, modelID string, catalogs map[string]config.Catalog, provider string) bool
SupportsVision reports whether the model accepts image input on provider.
Input modalities stored in the configuration are a deliberate setting (the model editor's override, or what the desktop host pushed), and they win over the provider's /models catalog: relays often list a vision model as text-only, and that override exists precisely to correct them. Without stored modalities the catalog decides, then the configured vision flag.
func TaskDefaultForContext ¶ added in v0.103.0
Types ¶
type FailoverClient ¶ added in v0.107.0
type FailoverClient struct {
// contains filtered or unexported fields
}
FailoverClient is the backend-owned provider queue. It buffers callbacks until the first visible delta, so discarded candidates cannot duplicate UI output or transcript events.
func (*FailoverClient) Clone ¶ added in v0.107.0
func (c *FailoverClient) Clone() ai.Client
func (*FailoverClient) Endpoint ¶ added in v0.107.0
func (c *FailoverClient) Endpoint() string
func (*FailoverClient) SetCacheKey ¶ added in v0.107.0
func (c *FailoverClient) SetCacheKey(key string)
func (*FailoverClient) SetOnRetry ¶ added in v0.107.0
func (c *FailoverClient) SetOnRetry(fn func(ai.RetryEvent))
func (*FailoverClient) SupportsNativeWebSearch ¶ added in v0.107.33
func (c *FailoverClient) SupportsNativeWebSearch() bool
SupportsNativeWebSearch follows the primary candidate, which serves the request unless it fails over.
type FailoverConfig ¶ added in v0.107.0
type FailoverSettings ¶ added in v0.107.0
type FailoverSettings struct {
Retry RetryPolicy
Failover FailoverConfig
}
func DefaultFailoverSettings ¶ added in v0.107.0
func DefaultFailoverSettings() FailoverSettings
func ParseProviderRuntimeSettings ¶ added in v0.107.0
func ParseProviderRuntimeSettings(provider config.Provider) (FailoverSettings, error)
ParseProviderRuntimeSettings reads the existing provider RetryPolicy map. It keeps failover runtime settings out of config.Provider so settings ownership remains with the existing provider settings contract.
type RetryPolicy ¶ added in v0.107.0
type Route ¶
type Route struct {
ModelName string
ProviderName string
Provider config.Provider
Model config.Model
APIModel string
Client ai.Client
ContextLimit int
MaxOutput int
Vision bool
}
func ResolveFailoverRouteContext ¶ added in v0.107.0
func ResolveFailoverRouteContext(ctx context.Context, cfg *config.Config, modelName, providerName string, optional bool) (Route, error)
ResolveFailoverRouteContext builds the backend-owned same-vendor queue for a selected model. The selected provider remains primary; provider settings and retry policy are captured per candidate at route construction time.
func ResolveRoute ¶
func ResolveRouteContext ¶ added in v0.103.0
func (Route) AgentModel ¶ added in v0.103.0
func (r Route) AgentModel() agent.ModelConfig