Documentation
¶
Overview ¶
Package registry provides an in-memory snapshot of enabled models for O(1) request name resolution on the hot path.
Index ¶
- type ModelRegistry
- func (r *ModelRegistry) AllEnabled() []*ResolvedModel
- func (r *ModelRegistry) AllRequestNames() []string
- func (r *ModelRegistry) Count() int
- func (r *ModelRegistry) EnabledByType(typ string) []*ResolvedModel
- func (r *ModelRegistry) Resolve(id string) (*ResolvedModel, bool)
- func (r *ModelRegistry) ResolvePoolFloor(requestName string) (floor string, ok bool)
- type ResolvedModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ModelRegistry ¶
type ModelRegistry struct {
// contains filtered or unexported fields
}
ModelRegistry maintains an in-memory snapshot of enabled models. The registry is read-only after construction; the mutex is retained to preserve the thread-safe API contract.
func NewModelRegistry ¶
func NewModelRegistry(specs []modelconfig.ModelSpec) *ModelRegistry
NewModelRegistry creates a read-only ModelRegistry from static catalog specs.
func NewTestRegistry ¶
func NewTestRegistry(specs []modelconfig.ModelSpec) *ModelRegistry
NewTestRegistry creates a ModelRegistry from ModelSpec slice for testing. This is an alias for NewModelRegistry for semantic clarity in test code.
func (*ModelRegistry) AllEnabled ¶
func (r *ModelRegistry) AllEnabled() []*ResolvedModel
AllEnabled returns all enabled models as a slice.
func (*ModelRegistry) AllRequestNames ¶
func (r *ModelRegistry) AllRequestNames() []string
AllRequestNames returns all registered model IDs (sorted). Retained for downstream compatibility.
func (*ModelRegistry) Count ¶
func (r *ModelRegistry) Count() int
Count returns the number of enabled models in the registry.
func (*ModelRegistry) EnabledByType ¶
func (r *ModelRegistry) EnabledByType(typ string) []*ResolvedModel
EnabledByType returns all enabled models of a given type. Returns an empty non-nil slice if no models match.
func (*ModelRegistry) Resolve ¶
func (r *ModelRegistry) Resolve(id string) (*ResolvedModel, bool)
Resolve looks up a model ID and returns the resolved model.
func (*ModelRegistry) ResolvePoolFloor ¶
func (r *ModelRegistry) ResolvePoolFloor(requestName string) (floor string, ok bool)
ResolvePoolFloor implements token.ModelResolver. Returns the effective pool floor for a model ID.
type ResolvedModel ¶
type ResolvedModel struct {
ID string
DisplayName string
Type string // internal runtime type
PublicType string // derived public type
Enabled bool
PoolFloor string // effective pool floor
QuotaMode string
UpstreamModel string
UpstreamMode string
ForceThinking bool
EnablePro bool
}
ResolvedModel holds the resolved model info for a model ID.