effort

package
v1.78.0 Latest Latest
Warning

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

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

Documentation

Overview

Package effort defines the canonical set of thinking-effort levels and provides per-provider mapping helpers. All provider packages should use this package instead of hard-coding effort strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BedrockTokens

func BedrockTokens(l Level) (int, bool)

BedrockTokens maps l to a token budget for Bedrock Claude, which only supports token-based thinking budgets.

func ForAnthropic

func ForAnthropic(l Level) (string, bool)

ForAnthropic returns the Anthropic output_config effort string for l. Anthropic accepts: low, medium, high, xhigh, max. xhigh is only supported by newer Claude models (e.g. Opus 4.7+). Minimal is mapped to low as the closest equivalent.

func ForGemini3

func ForGemini3(l Level) (string, bool)

ForGemini3 returns the Gemini 3 thinking-level string for l. Gemini 3 accepts: minimal, low, medium, high.

func ForOpenAI

func ForOpenAI(l Level) (string, bool)

ForOpenAI returns the OpenAI reasoning_effort string for l. OpenAI accepts: minimal, low, medium, high, xhigh.

func IsValid

func IsValid(s string) bool

IsValid reports whether s is a recognised thinking_budget effort value. It accepts every Level constant, plain "adaptive", and the "adaptive/<effort>" form.

func IsValidAdaptive

func IsValidAdaptive(sub string) bool

IsValidAdaptive reports whether sub is a valid effort for "adaptive/<sub>".

func ValidNames

func ValidNames() string

ValidNames returns a human-readable list of accepted values, suitable for error messages.

Types

type Level

type Level string

Level represents a thinking effort level.

const (
	None    Level = "none"
	Minimal Level = "minimal"
	Low     Level = "low"
	Medium  Level = "medium"
	High    Level = "high"
	XHigh   Level = "xhigh"
	Max     Level = "max"
)

func NextThinkingLevel added in v1.78.0

func NextThinkingLevel(providerType string, current Level) Level

NextThinkingLevel returns the level following current in the provider's thinking cycle, wrapping back to the first level. When current is not in the cycle the first level is returned.

func Parse

func Parse(s string) (Level, bool)

Parse normalises s (case-insensitive, trimmed) and returns the matching Level. It returns ("", false) for unknown strings, adaptive values, and empty input. Use IsValid for full validation including adaptive forms.

func ThinkingCycle added in v1.78.0

func ThinkingCycle(providerType string) []Level

ThinkingCycle returns the ordered list of selectable thinking-effort levels for the given provider type. The provider type is matched case-insensitively and tolerant of aliases (e.g. "amazon-bedrock" maps onto the underlying Anthropic family).

func (Level) String

func (l Level) String() string

String returns the string representation of the Level.

Jump to

Keyboard shortcuts

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