models

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package models registers the list_models tool the root agent uses to discover which LLM models each configured provider offers. The root needs this when composing dynamic workers: it lets the model pick a smaller, cheaper model for a trivial sub-task or a larger one for a hard task, instead of blindly reusing the root's own model.

The catalogue is catwalk's embedded model database (the same source the TUI uses for model autocompletion and that contextguard uses for per-model context windows), so listing models is a zero-I/O lookup, no network call to the provider's /models endpoint. A provider whose type catwalk does not catalogue, or one pointed at a custom endpoint via url (any OpenAI-compatible server: Ollama, OpenRouter, vLLM, ...), reports a note instead of a catalogue so the LLM does not assume the endpoint serves the canonical model list.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

type Catalog interface {
	// ConfiguredProviders returns the providers declared in baifo.yaml.
	ConfiguredProviders() []ProviderRef
}

Catalog is the dependency the tool needs from the App: the list of providers the operator actually configured. Kept narrow so this package does not import internal/app or internal/config.

type ListModelsResult

type ListModelsResult struct {
	Providers []ProviderModels `json:"providers"`
}

ListModelsResult is the tool's return value.

type ModelInfo

type ModelInfo struct {
	ID            string `json:"id"`
	Name          string `json:"name,omitempty"`
	ContextWindow int64  `json:"context_window,omitempty"`
	MaxOutput     int64  `json:"max_output_tokens,omitempty"`
	CanReason     bool   `json:"can_reason,omitempty"`
	// ReasoningLevels lists the effort levels this model accepts (e.g.
	// "low", "medium", "high"), when the catalogue records them. Pass
	// one of these as `reasoning` in a spawn spec to control how hard
	// the worker thinks. Empty when the model is not a reasoning model
	// or the catalogue has no level data.
	ReasoningLevels []string `json:"reasoning_levels,omitempty"`
	// DefaultReasoningEffort is the effort the model uses when none is
	// requested. Empty when unknown / not applicable.
	DefaultReasoningEffort string  `json:"default_reasoning_effort,omitempty"`
	CostPer1MIn            float64 `json:"cost_per_1m_in,omitempty"`
	CostPer1MOut           float64 `json:"cost_per_1m_out,omitempty"`
}

ModelInfo is one model's relevant metadata for a sizing decision. Cost is per 1M tokens in USD as catwalk records it.

type ProviderModels

type ProviderModels struct {
	Provider     string      `json:"provider"`
	Type         string      `json:"type"`
	DefaultSmall string      `json:"default_small_model,omitempty"`
	DefaultLarge string      `json:"default_large_model,omitempty"`
	Models       []ModelInfo `json:"models,omitempty"`
	Note         string      `json:"note,omitempty"`
}

ProviderModels is the per-provider block of the result. DefaultSmall and DefaultLarge are catwalk's own "small/cheap" and "large/capable" picks for the provider (the cheapest signal for "use a smaller or bigger model" the root asked for).

type ProviderRef

type ProviderRef struct {
	Name string
	Type string
	URL  string
}

ProviderRef is one provider as declared in baifo.yaml: its unique configured Name (what the root passes as `llm.provider` in a spawn spec), its Type (gemini, openai, anthropic), which is what we map to the catwalk catalogue, and its URL. A non-empty URL marks a custom endpoint: the catwalk catalogue for the type cannot describe what that endpoint actually serves, so it is reported with a note instead.

type Tools

type Tools struct {
	Catalog Catalog
}

Tools bundles the dependencies needed to build the list_models tool.

func (*Tools) ADKTools

func (t *Tools) ADKTools() ([]tool.Tool, error)

ADKTools returns the single list_models tool. Returns an empty slice (no error) when no catalog is wired, so a misconfiguration degrades to "tool absent" rather than a boot failure.

Jump to

Keyboard shortcuts

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