Documentation
¶
Overview ¶
Package modelinfo centralizes every model-specific behavior decision used by docker-agent's provider clients.
Some providers must specialize their behavior depending on the underlying model: pick OpenAI's Responses API for o-series and gpt-5, switch Claude Opus 4.6+ to adaptive thinking, use level-based thinking for Gemini 3+, auto-enable interleaved thinking for any Claude model regardless of host (Anthropic, Bedrock, Vertex AI Model Garden), and so on.
Rather than scattering name-pattern checks across the codebase, every such predicate lives here, with a name that describes the *capability* (not the version) and a doc comment that explains *why* the behavior is needed.
Two layers ¶
- "Is*" predicates take a bare model identifier and use stable name patterns. They are zero-allocation and safe to call on the request hot path.
- The Capability lookup helpers (LookupFamily, IsClaudeFamily, ...) use the models.dev database via a modelsdev.Store when richer information is needed (e.g. detecting Claude across providers). They are intended for config-resolution paths, not per-request paths.
Adding a new model ¶
New members of an existing family inherit behavior automatically as long as their model identifiers follow the family's naming convention; in that case no code change is needed. New behavior categories belong in this package, expressed as a capability-named predicate with a comment that explains the underlying API rule.
Index ¶
- func AlwaysReasons(modelID string) bool
- func IsBedrockClaudeID(modelID string) bool
- func IsClaude(ctx context.Context, store *modelsdev.Store, providerID, modelID string) bool
- func IsClaudeFamily(family string) bool
- func LookupFamily(ctx context.Context, store *modelsdev.Store, providerID, modelID string) string
- func RejectsTokenThinking(modelID string) bool
- func SupportsResponsesAPI(modelID string) bool
- func UsesReasoningEffort(modelID string) bool
- func UsesThinkingLevel(modelID string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlwaysReasons ¶
AlwaysReasons reports whether an OpenAI model always reasons internally and therefore needs a default thinking_budget when none is configured.
The o1/o3/o4 reasoning families cannot operate without thinking; they are seeded with reasoning_effort=medium when no thinking_budget is supplied. gpt-5 is excluded: it can produce visible output without reasoning, so the default depends on the user's intent.
func IsBedrockClaudeID ¶
IsBedrockClaudeID reports whether a model identifier looks like an Anthropic Claude model on AWS Bedrock.
Bedrock model IDs are prefixed with "anthropic." or with a regional inference profile such as "global.anthropic." or "us.anthropic.".
Prefer IsClaude for cross-provider checks: this helper exists so callers in the Bedrock path can avoid touching the models.dev store.
func IsClaude ¶
IsClaude reports whether a model belongs to the Claude family, regardless of provider (Anthropic, AWS Bedrock, GCP Vertex AI Model Garden, ...).
Resolution order:
- The models.dev database, when [store] is non-nil and the model is registered: the family is checked against IsClaudeFamily.
- Provider-specific name patterns (Bedrock-style IDs).
- A bare "claude-" prefix on the model name.
Pass a nil store to skip the models.dev lookup entirely (the name-pattern fallback still works, which is fine for the common case).
func IsClaudeFamily ¶
IsClaudeFamily reports whether a models.dev family identifier corresponds to one of the Claude families (claude-opus, claude-sonnet, claude-haiku, claude-instant, ...). Returns false for the empty string.
func LookupFamily ¶
LookupFamily returns the canonical model family identifier from models.dev (e.g. "claude-opus", "claude-sonnet", "gemini-pro", "o", "o-mini", "gpt").
Returns "" when the store is nil, the providerID/modelID is empty, or the model is not registered in the database. Callers that want a non-empty answer for unknown models should fall back to a name-pattern heuristic.
func RejectsTokenThinking ¶
RejectsTokenThinking reports whether an Anthropic Claude model rejects `thinking.type=enabled` (token-based extended thinking) and instead requires `thinking.type=adaptive`.
Currently Claude Opus 4.6 and 4.7 (and dated variants like claude-opus-4-7-20251101). For these models the agent transparently switches a token-based budget to adaptive thinking.
See https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking
func SupportsResponsesAPI ¶
SupportsResponsesAPI reports whether an OpenAI model should be served via the Responses API rather than the legacy Chat Completions API.
The Responses API is the forward path for newer OpenAI models: gpt-4.1, the o-series (o1/o3/o4), gpt-5 and Codex variants. Older models stay on Chat Completions for compatibility.
func UsesReasoningEffort ¶
UsesReasoningEffort reports whether an OpenAI model accepts the `reasoning.effort` API parameter.
All reasoning-capable OpenAI models do, except the gpt-5-chat variants which are non-reasoning chat models at the API level.
func UsesThinkingLevel ¶
UsesThinkingLevel reports whether a Google Gemini model uses level-based thinking configuration (`thinkingLevel`) rather than token-based budgets.
Gemini 3+ models always reason and only accept ThinkingLevel; older Gemini 2.5 models accept the legacy ThinkingBudget tokens.
Matches both "gemini-3-<family>" and "gemini-3.X-<family>" patterns.
Types ¶
This section is empty.