modelrouter

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DefaultTier Tier        `yaml:"default_tier"`
	Low         ModelConfig `yaml:"low"`
	Medium      ModelConfig `yaml:"medium"`
	High        ModelConfig `yaml:"high"`
}

func DefaultConfig

func DefaultConfig() Config

func LoadConfig

func LoadConfig(path string) (Config, error)

type ModelConfig

type ModelConfig struct {
	Provider  string `yaml:"provider"`
	Model     string `yaml:"model"`
	APIKey    string `yaml:"api_key,omitempty"`
	APIKeyEnv string `yaml:"api_key_env,omitempty"`
}

type ModelRouter

type ModelRouter interface {
	Select(ctx context.Context, tier Tier) (ModelSelection, error)
}

func New

func New(cfg Config, logger *slog.Logger) ModelRouter

func NewWithEnvOverride

func NewWithEnvOverride(cfg Config, logger *slog.Logger) ModelRouter

type ModelSelection

type ModelSelection struct {
	Tier     Tier
	Provider string
	Model    string
	APIKey   string
}

type Tier

type Tier string
const (
	TierLow    Tier = "low"
	TierMedium Tier = "medium"
	TierHigh   Tier = "high"
)

func (Tier) Valid

func (t Tier) Valid() bool

Jump to

Keyboard shortcuts

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