Documentation
¶
Overview ¶
Package modelreg resolves model token limits from live registries, provider catalogues, static metadata, and finally a safe default.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProviderHTTPStatus ¶
ProviderHTTPStatus exposes upstream provider/catalogue HTTP failures to service boundaries without leaking transport implementation details.
Types ¶
type Option ¶
type Option func(*Registry)
Option configures a Registry.
func WithHTTPClient ¶
WithHTTPClient overrides the HTTP client (used in tests).
type ProviderModel ¶
type ProviderModel struct {
ID string `json:"id"`
Name string `json:"name"`
ContextWindow int `json:"contextWindow,omitempty"`
MaxOutputTokens int `json:"maxOutputTokens,omitempty"`
}
ProviderModel is a chat model advertised by a provider's API.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry resolves model limits. It is safe for concurrent use.
func (*Registry) ContextWindow ¶
ContextWindow resolves a model's context window from the registries, or the safe default when unknown. Never returns 0.
func (*Registry) FetchModels ¶
func (r *Registry) FetchModels(ctx context.Context, kind, baseURL, apiKey string) ([]ProviderModel, error)
FetchModels lists a provider's chat models from its API, cached per provider+baseURL. kind selects the wire format; baseURL falls back to the vendor default for built-in kinds.