modelrouter

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 4 Imported by: 1 module, 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

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