model

package
v0.9.22 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package model is a registry of provider-side model capabilities keyed by model id.

Resolve maps a model id to an Info describing which request parameters the provider accepts for it: the backend the id routes to, the effort levels the provider takes natively, whether the sampling parameters (temperature, top_p, top_k) are accepted, whether the Claude extended-thinking budget parameter is accepted, and which generation of Gemini thinking knob applies.

The registry encodes generation rules plus exception prefixes rather than an exhaustive id list: capabilities derive from the id's backend and version, and small prefix tables list only the models verified to lack a parameter. An id matching no exception prefix therefore resolves to the newest capability surface for its backend — a deliberate bias, so a freshly released model works without a registry change and the exception tables grow only when a model is verified to reject a parameter.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend string

Backend identifies the provider surface a model id routes to.

const (
	// BackendClaude covers ids with the "claude-" prefix, served by the
	// Anthropic API.
	BackendClaude Backend = "claude"
	// BackendGemini covers ids with the "gemini-" prefix, served by the
	// Google Generative AI API.
	BackendGemini Backend = "gemini"
	// BackendOpenAICompat covers "publisher/model" ids, served by an
	// OpenAI-compatible endpoint.
	BackendOpenAICompat Backend = "openai-compat"
	// BackendUnknown is the zero value, for ids that match no known routing
	// shape.
	BackendUnknown Backend = ""
)

type Info

type Info struct {
	// Backend is the provider surface the model id routes to.
	Backend Backend
	// Efforts lists the effort levels the provider accepts natively; empty
	// means the effort parameter is unsupported.
	Efforts []effort.Level
	// SamplingParams reports whether temperature/top_p/top_k are accepted.
	SamplingParams bool
	// ExtendedThinkingBudget reports whether the Claude thinking.budget_tokens
	// parameter is accepted.
	ExtendedThinkingBudget bool
	// ThinkingControl is the Gemini thinking-knob generation the model takes.
	ThinkingControl ThinkingControl
}

Info describes the provider-side capabilities of a model.

func Resolve

func Resolve(id string) Info

Resolve returns the capability Info for the given model id. The backend is determined from the id's routing shape, matching prefixes case-insensitively; ids that match no known shape resolve to the zero Info (BackendUnknown, no capabilities).

Example
package main

import (
	"fmt"

	"chainguard.dev/driftlessaf/agents/model"
)

func main() {
	info := model.Resolve("claude-fable-5")
	fmt.Println(info.Backend)
	fmt.Println(info.SamplingParams)
	fmt.Println(info.Efforts)

	info = model.Resolve("gemini-3-pro-preview")
	fmt.Println(info.Backend)
	fmt.Println(info.ThinkingControl)
}
Output:
claude
false
[low medium high xhigh max]
gemini
level

func (Info) SupportsEffort

func (i Info) SupportsEffort(l effort.Level) bool

SupportsEffort reports whether the provider accepts the effort level natively for this model.

Example
package main

import (
	"fmt"

	"chainguard.dev/driftlessaf/agents/effort"
	"chainguard.dev/driftlessaf/agents/model"
)

func main() {
	fmt.Println(model.Resolve("claude-opus-4-6").SupportsEffort(effort.XHigh))
	fmt.Println(model.Resolve("claude-fable-5").SupportsEffort(effort.XHigh))
}
Output:
false
true

type ThinkingControl

type ThinkingControl string

ThinkingControl identifies which generation of Gemini thinking knob a model takes.

const (
	// ThinkingControlNone marks backends without a Gemini-style knob.
	ThinkingControlNone ThinkingControl = ""
	// ThinkingControlBudget marks Gemini models before 3.x, which take a
	// thinkingBudget token count.
	ThinkingControlBudget ThinkingControl = "budget"
	// ThinkingControlLevel marks Gemini 3.x and later, which take a discrete
	// thinkingLevel enum.
	ThinkingControlLevel ThinkingControl = "level"
)

Jump to

Keyboard shortcuts

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