effort

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 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, max. 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 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 (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