registry

package
v0.2.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package registry provides an in-memory snapshot of enabled models for O(1) request name resolution on the hot path.

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL