thinking

package
v0.260827.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MPL-2.0 Imports: 0 Imported by: 0 modules, 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

Overview

Package thinking holds the canonical thinking-effort ladder shared across the gateway. It is a leaf package (no internal deps) so both internal/typ and the protocol conversion layer can import it without cycles.

Effort is the primary axis across providers: OpenAI reasoning_effort (none/minimal/low/medium/high/xhigh/max), Anthropic output_config.effort (low/medium/high/xhigh/max, Claude 4.5+), and Gemini 3 thinking_level (minimal/low/medium/high) are all effort-based. Token budgets remain only as the fallback dialect for budget-based targets (Claude ≤ 4.5 thinking.budget_tokens, Gemini 2.5 thinking_budget) via BudgetMapping / EffortFromBudget.

Index

Constants

This section is empty.

Variables

View Source
var BudgetMapping = map[Level]int64{
	LevelMinimal: 1024,
	LevelLow:     4096,
	LevelMedium:  10240,
	LevelHigh:    20480,
	LevelXHigh:   24576,
	LevelMax:     31999,
}

BudgetMapping defines fallback budget_tokens for each effort level, used only when the target speaks budgets instead of effort levels. "off" / "" are intentionally absent — they signal disabled / pass-through, not a budget value, and are handled out-of-band by the transform layer.

Functions

This section is empty.

Types

type Level

type Level = string

Level represents a thinking effort level for extended thinking.

const (
	// LevelDefault is the "by client" sentinel: pass the client's thinking
	// config through unchanged. Empty string so omitempty hides it.
	LevelDefault Level = ""
	// LevelOff is the "explicitly disabled" sentinel: strip thinking from the
	// outbound request regardless of what the client sent. (OpenAI's "none"
	// level maps here, not to a ladder entry.)
	LevelOff     Level = "off"
	LevelMinimal Level = "minimal"
	LevelLow     Level = "low"
	LevelMedium  Level = "medium"
	LevelHigh    Level = "high"
	LevelXHigh   Level = "xhigh"
	LevelMax     Level = "max"
)

func EffortFromBudget

func EffortFromBudget(budget int64) Level

EffortFromBudget is the inverse of BudgetMapping: it tiers an explicit budget_tokens value back onto the effort ladder. This is the single canonical budget→effort conversion for effort-based targets fed by budget-based clients. Thresholds are inclusive of each tier's own budget so the two mappings round-trip.

Jump to

Keyboard shortcuts

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