Documentation
¶
Index ¶
- func ActiveSources(cfg *config.Config) []discoverycache.Source
- type AssembleOptions
- type KnownModel
- type ModelSnapshot
- func Assemble(ctx context.Context, cfg *config.Config, cat *modelcatalog.Catalog, ...) (ModelSnapshot, error)
- func AssembleWithOptions(ctx context.Context, cfg *config.Config, cat *modelcatalog.Catalog, ...) (ModelSnapshot, error)
- func RefreshModels(ctx context.Context, cfg *config.Config, cat *modelcatalog.Catalog, ...) (ModelSnapshot, error)
- func Warmup(ctx context.Context, cfg *config.Config, cat *modelcatalog.Catalog, ...) (ModelSnapshot, error)
- type ModelStatus
- type RefreshMode
- type RefreshScope
- type Source
- type SourceMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveSources ¶
func ActiveSources(cfg *config.Config) []discoverycache.Source
ActiveSources returns the cache sources that are currently configured and should be preserved by cache garbage collection.
Types ¶
type AssembleOptions ¶
type AssembleOptions struct {
Refresh RefreshMode
}
AssembleOptions controls snapshot assembly behavior.
type KnownModel ¶
type KnownModel struct {
Provider string `json:"provider,omitempty"`
ProviderType string `json:"provider_type,omitempty"`
Harness string `json:"harness,omitempty"`
ID string `json:"model,omitempty"`
Configured bool `json:"configured,omitempty"`
EndpointName string `json:"endpoint_name,omitempty"`
EndpointBaseURL string `json:"endpoint_base_url,omitempty"`
ServerInstance string `json:"server_instance,omitempty"`
Billing modelcatalog.BillingModel `json:"billing,omitempty"`
IncludeByDefault bool `json:"include_by_default,omitempty"`
DiscoveredVia Source `json:"model_discovery_freshness_source,omitempty"`
DiscoveredAt time.Time `json:"model_discovery_freshness_at,omitempty"`
Family string `json:"family,omitempty"`
Version []int `json:"version,omitempty"`
Tier modelcatalog.Tier `json:"tier,omitempty"`
PreRelease bool `json:"pre_release,omitempty"`
Power int `json:"power,omitempty"`
CostInputPerM float64 `json:"cost_input_per_m,omitempty"`
CostOutputPerM float64 `json:"cost_output_per_m,omitempty"`
ContextWindow int `json:"context_window,omitempty"`
ReasoningLevels []string `json:"reasoning_levels,omitempty"`
QuotaPool string `json:"quota_pool,omitempty"`
QuotaRemaining *int `json:"quota_remaining,omitempty"`
RecentP50Latency time.Duration `json:"recent_p50_latency_ns,omitempty"`
Status ModelStatus `json:"status,omitempty"`
HealthFreshnessAt time.Time `json:"health_freshness_at,omitempty"`
HealthFreshnessSource string `json:"health_freshness_source,omitempty"`
QuotaFreshnessAt time.Time `json:"quota_freshness_at,omitempty"`
QuotaFreshnessSource string `json:"quota_freshness_source,omitempty"`
ActualCashSpend bool `json:"actual_cash_spend"`
EffectiveCost float64 `json:"effective_cost"`
EffectiveCostSource string `json:"effective_cost_source,omitempty"`
SupportsTools bool `json:"supports_tools,omitempty"`
DeploymentClass string `json:"deployment_class,omitempty"`
AutoRoutable bool `json:"auto_routable,omitempty"`
ExactPinOnly bool `json:"exact_pin_only,omitempty"`
ExclusionReason string `json:"exclusion_reason,omitempty"`
}
KnownModel is one discovered provider/model identity enriched with catalog metadata when the catalog knows the model.
func EnrichModel ¶
func EnrichModel(model KnownModel, includeByDefault bool, cat *modelcatalog.Catalog) KnownModel
type ModelSnapshot ¶
type ModelSnapshot struct {
Models []KnownModel `json:"models,omitempty"`
AsOf time.Time `json:"as_of,omitempty"`
Sources map[string]SourceMeta `json:"sources,omitempty"`
}
ModelSnapshot is the in-memory model registry view assembled from discovery cache entries and catalog metadata.
func Assemble ¶
func Assemble(ctx context.Context, cfg *config.Config, cat *modelcatalog.Catalog, cache *discoverycache.Cache) (ModelSnapshot, error)
Assemble builds a ModelSnapshot from configured providers, cache-backed discovery, runtime status cache state, and model catalog metadata.
func AssembleWithOptions ¶
func AssembleWithOptions(ctx context.Context, cfg *config.Config, cat *modelcatalog.Catalog, cache *discoverycache.Cache, opts AssembleOptions) (ModelSnapshot, error)
AssembleWithOptions builds a ModelSnapshot with explicit cache refresh behavior for CLI and routing consumers.
func RefreshModels ¶ added in v0.12.3
func RefreshModels(ctx context.Context, cfg *config.Config, cat *modelcatalog.Catalog, cache *discoverycache.Cache, scope RefreshScope) (ModelSnapshot, error)
RefreshModels synchronously rebuilds the snapshot after refreshing stale cache-backed fields through the coordinated refresh path.
func Warmup ¶ added in v0.12.3
func Warmup(ctx context.Context, cfg *config.Config, cat *modelcatalog.Catalog, cache *discoverycache.Cache) (ModelSnapshot, error)
Warmup is the public synchronous refresh entrypoint for callers that want to keep the assembled snapshot fresh from a heartbeat.
type ModelStatus ¶
type ModelStatus string
ModelStatus records the provider runtime state relevant to routing.
const ( StatusAvailable ModelStatus = "available" StatusRateLimited ModelStatus = "rate_limited" StatusUnreachable ModelStatus = "unreachable" StatusUnknown ModelStatus = "unknown" )
type RefreshMode ¶
type RefreshMode int
RefreshMode controls whether Assemble refreshes stale source cache data.
const ( // RefreshBackground preserves the default stale-while-revalidate behavior: // return cached data immediately and refresh stale sources in the background. RefreshBackground RefreshMode = iota // RefreshNone returns cached data only. RefreshNone // RefreshForce refreshes sources synchronously before reading them. RefreshForce // RefreshIfStale refreshes ONLY stale sources synchronously; fresh sources // short-circuit on the cached entry. Reserve this for explicit refresh or // preflight surfaces; request routing uses RefreshBackground so stale // providers cannot block candidate scoring. RefreshIfStale )
type RefreshScope ¶ added in v0.12.3
type RefreshScope string
RefreshScope names the synchronous snapshot refresh scopes exposed to long-running callers.
const ( RefreshRouting RefreshScope = "routing" RefreshAll RefreshScope = "all" )