|
1 | | -package config |
2 | | - |
3 | | -// ModelCatalogConfig controls models.dev catalog usage, local cache, optional external refresh, and operator overrides. |
4 | | -// Concrete fetch/cache adapters live outside core config; this struct is the typed operator surface (see design: ModelCatalogConfig). |
5 | | -type ModelCatalogConfig struct { |
6 | | - // Enabled when true uses the latest valid local catalog snapshot for request-time decisions (when present). |
7 | | - Enabled bool `yaml:"enabled"` |
8 | | - // ExternalUpdatesEnabled when true allows periodic background fetches of the catalog source (independent of Enabled). |
9 | | - ExternalUpdatesEnabled bool `yaml:"external_updates_enabled"` |
10 | | - // UpdateInterval is a Go duration string (e.g. "1h") for automatic refresh when ExternalUpdatesEnabled is true. |
11 | | - UpdateInterval string `yaml:"update_interval"` |
12 | | - // FetchTimeout is an optional Go duration string applied to catalog HTTP GET when the request context has no |
13 | | - // deadline (0 or empty = rely on transport/client timeouts only). |
14 | | - FetchTimeout string `yaml:"fetch_timeout"` |
15 | | - // SourceURL is the HTTPS (or HTTP) URL for the catalog snapshot when ExternalUpdatesEnabled is true. |
16 | | - SourceURL string `yaml:"source_url"` |
17 | | - // CachePath is the local filesystem path for the persisted snapshot file used when Enabled or ExternalUpdatesEnabled. |
18 | | - CachePath string `yaml:"cache_path"` |
19 | | - // DiagnosticsPath when non-empty registers catalog status JSON under this absolute URL path (must not overlap other diagnostics paths). |
20 | | - DiagnosticsPath string `yaml:"diagnostics_path"` |
21 | | - // ModelOverrides are operator facts keyed by route/catalog model name (see spec requirement 5.1). |
22 | | - ModelOverrides []ModelCatalogModelOverrideEntry `yaml:"model_overrides"` |
23 | | - // BackendModelOverrides take precedence over ModelOverrides for matching backend/model pairs (requirement 5.2). |
24 | | - BackendModelOverrides []ModelCatalogBackendModelOverrideEntry `yaml:"backend_model_overrides"` |
25 | | -} |
26 | | - |
27 | | -// ModelCatalogModelOverrideEntry is one model-scoped override row from configuration. |
28 | | -// Optional capability and limit fields use YAML omission for "unknown"; for booleans, true means |
29 | | -// explicitly supported and false means explicitly unsupported (runtimebundle maps into modelcatalog). |
30 | | -type ModelCatalogModelOverrideEntry struct { |
31 | | - Model string `yaml:"model"` |
32 | | - |
33 | | - Tools *bool `yaml:"tools,omitempty"` |
34 | | - StructuredOutputs *bool `yaml:"structured_outputs,omitempty"` |
35 | | - Reasoning *bool `yaml:"reasoning,omitempty"` |
36 | | - Vision *bool `yaml:"vision,omitempty"` |
37 | | - Documents *bool `yaml:"documents,omitempty"` |
38 | | - |
39 | | - ContextLimitTokens *int64 `yaml:"context_limit_tokens,omitempty"` |
40 | | - InputLimitTokens *int64 `yaml:"input_limit_tokens,omitempty"` |
41 | | - OutputLimitTokens *int64 `yaml:"output_limit_tokens,omitempty"` |
42 | | -} |
43 | | - |
44 | | -// ModelCatalogBackendModelOverrideEntry is one backend+model pair override row from configuration. |
45 | | -type ModelCatalogBackendModelOverrideEntry struct { |
46 | | - Backend string `yaml:"backend"` |
47 | | - Model string `yaml:"model"` |
48 | | - |
49 | | - Tools *bool `yaml:"tools,omitempty"` |
50 | | - StructuredOutputs *bool `yaml:"structured_outputs,omitempty"` |
51 | | - Reasoning *bool `yaml:"reasoning,omitempty"` |
52 | | - Vision *bool `yaml:"vision,omitempty"` |
53 | | - Documents *bool `yaml:"documents,omitempty"` |
54 | | - |
55 | | - ContextLimitTokens *int64 `yaml:"context_limit_tokens,omitempty"` |
56 | | - InputLimitTokens *int64 `yaml:"input_limit_tokens,omitempty"` |
57 | | - OutputLimitTokens *int64 `yaml:"output_limit_tokens,omitempty"` |
58 | | -} |
| 1 | +package config |
| 2 | + |
| 3 | +// ModelCatalogConfig controls models.dev catalog usage, local cache, optional external refresh, and operator overrides. |
| 4 | +// Concrete fetch/cache adapters live outside core config; this struct is the typed operator surface (see design: ModelCatalogConfig). |
| 5 | +type ModelCatalogConfig struct { |
| 6 | + // Enabled when true uses the latest valid local catalog snapshot for request-time decisions (when present). |
| 7 | + Enabled bool `yaml:"enabled"` |
| 8 | + // ExternalUpdatesEnabled when true allows periodic background fetches of the catalog source (independent of Enabled). |
| 9 | + ExternalUpdatesEnabled bool `yaml:"external_updates_enabled"` |
| 10 | + // UpdateInterval is a Go duration string (e.g. "1h") for automatic refresh when ExternalUpdatesEnabled is true. |
| 11 | + UpdateInterval string `yaml:"update_interval"` |
| 12 | + // FetchTimeout is an optional Go duration string applied to catalog HTTP GET when the request context has no |
| 13 | + // deadline (0 or empty = rely on transport/client timeouts only). |
| 14 | + FetchTimeout string `yaml:"fetch_timeout"` |
| 15 | + // SourceURL is the HTTPS (or HTTP) URL for the catalog snapshot when ExternalUpdatesEnabled is true. |
| 16 | + SourceURL string `yaml:"source_url"` |
| 17 | + // CachePath is the local filesystem path for the persisted snapshot file used when Enabled or ExternalUpdatesEnabled. |
| 18 | + CachePath string `yaml:"cache_path"` |
| 19 | + // DiagnosticsPath when non-empty registers catalog status JSON under this absolute URL path (must not overlap other diagnostics paths). |
| 20 | + DiagnosticsPath string `yaml:"diagnostics_path"` |
| 21 | + // ModelOverrides are operator facts keyed by route/catalog model name (see spec requirement 5.1). |
| 22 | + ModelOverrides []ModelCatalogModelOverrideEntry `yaml:"model_overrides"` |
| 23 | + // BackendModelOverrides take precedence over ModelOverrides for matching backend/model pairs (requirement 5.2). |
| 24 | + BackendModelOverrides []ModelCatalogBackendModelOverrideEntry `yaml:"backend_model_overrides"` |
| 25 | +} |
| 26 | + |
| 27 | +// ModelCatalogModelOverrideEntry is one model-scoped override row from configuration. |
| 28 | +// Optional capability and limit fields use YAML omission for "unknown"; for booleans, true means |
| 29 | +// explicitly supported and false means explicitly unsupported (runtimebundle maps into modelcatalog). |
| 30 | +type ModelCatalogModelOverrideEntry struct { |
| 31 | + Model string `yaml:"model"` |
| 32 | + |
| 33 | + Tools *bool `yaml:"tools,omitempty"` |
| 34 | + StructuredOutputs *bool `yaml:"structured_outputs,omitempty"` |
| 35 | + Reasoning *bool `yaml:"reasoning,omitempty"` |
| 36 | + Vision *bool `yaml:"vision,omitempty"` |
| 37 | + Documents *bool `yaml:"documents,omitempty"` |
| 38 | + |
| 39 | + ContextLimitTokens *int64 `yaml:"context_limit_tokens,omitempty"` |
| 40 | + InputLimitTokens *int64 `yaml:"input_limit_tokens,omitempty"` |
| 41 | + OutputLimitTokens *int64 `yaml:"output_limit_tokens,omitempty"` |
| 42 | +} |
| 43 | + |
| 44 | +// ModelCatalogBackendModelOverrideEntry is one backend+model pair override row from configuration. |
| 45 | +type ModelCatalogBackendModelOverrideEntry struct { |
| 46 | + Backend string `yaml:"backend"` |
| 47 | + Model string `yaml:"model"` |
| 48 | + |
| 49 | + Tools *bool `yaml:"tools,omitempty"` |
| 50 | + StructuredOutputs *bool `yaml:"structured_outputs,omitempty"` |
| 51 | + Reasoning *bool `yaml:"reasoning,omitempty"` |
| 52 | + Vision *bool `yaml:"vision,omitempty"` |
| 53 | + Documents *bool `yaml:"documents,omitempty"` |
| 54 | + |
| 55 | + ContextLimitTokens *int64 `yaml:"context_limit_tokens,omitempty"` |
| 56 | + InputLimitTokens *int64 `yaml:"input_limit_tokens,omitempty"` |
| 57 | + OutputLimitTokens *int64 `yaml:"output_limit_tokens,omitempty"` |
| 58 | +} |
0 commit comments