reasoning

package
v0.14.32 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PortableBudgets = map[Reasoning]int{
	ReasoningOff:    0,
	ReasoningLow:    2048,
	ReasoningMedium: 8192,
	ReasoningHigh:   32768,
}

PortableBudgets are fallback named reasoning token budgets.

Functions

func BudgetFor

func BudgetFor(policy Policy, budgets map[Reasoning]int, maxTokens int) (int, error)

func BudgetForNamed added in v0.12.2

func BudgetForNamed(r Reasoning) int

BudgetForNamed returns the PortableBudgets token budget for a named reasoning tier. Returns 0 for tiers without a portable budget (off, minimal, xhigh, max).

Types

type Kind

type Kind string
const (
	KindUnset  Kind = "unset"
	KindAuto   Kind = "auto"
	KindOff    Kind = "off"
	KindNamed  Kind = "named"
	KindTokens Kind = "tokens"
)

type Policy

type Policy struct {
	Kind   Kind
	Value  Reasoning
	Tokens int
}

func Parse

func Parse(value any) (Policy, error)

func ParseString

func ParseString(value string) (Policy, error)

func (Policy) IsExplicitOff

func (p Policy) IsExplicitOff() bool

func (Policy) IsSet

func (p Policy) IsSet() bool

type Reasoning

type Reasoning string

Reasoning is the canonical scalar for model-side reasoning controls.

const (
	ReasoningAuto    Reasoning = "auto"
	ReasoningOff     Reasoning = "off"
	ReasoningLow     Reasoning = "low"
	ReasoningMedium  Reasoning = "medium"
	ReasoningHigh    Reasoning = "high"
	ReasoningMinimal Reasoning = "minimal"
	ReasoningXHigh   Reasoning = "xhigh"
	ReasoningMax     Reasoning = "max"
)

func NearestTierForTokens added in v0.12.2

func NearestTierForTokens(n int) Reasoning

NearestTierForTokens snaps a token count to the nearest PortableBudgets tier using log2-scale distance; ties round up to the higher tier. Boundaries (geometric midpoints): <4096 → low, [4096,16384) → medium, ≥16384 → high.

func Normalize

func Normalize(value string) (Reasoning, error)

func ReasoningTokens

func ReasoningTokens(n int) Reasoning

ReasoningTokens returns a numeric reasoning-token request.

func (*Reasoning) UnmarshalJSON

func (r *Reasoning) UnmarshalJSON(data []byte) error

func (*Reasoning) UnmarshalYAML

func (r *Reasoning) UnmarshalYAML(value *yaml.Node) error

type ResolutionSource added in v0.12.2

type ResolutionSource string
const (
	ResolutionSourceCaller  ResolutionSource = "caller"
	ResolutionSourceSnapped ResolutionSource = "snapped"
	ResolutionSourceDefault ResolutionSource = "default"
)

type SupportedResolution added in v0.12.2

type SupportedResolution struct {
	Policy    Policy
	Source    ResolutionSource
	Warning   string
	Reason    string
	Supported []Reasoning
}

func ResolveAgainstSupportedLevels added in v0.12.2

func ResolveAgainstSupportedLevels(policy Policy, supportedLevels []string) (SupportedResolution, error)

ResolveAgainstSupportedLevels validates a caller policy against discovered harness reasoning levels. Empty or unparsable support lists deliberately keep the existing behavior: the caller policy is returned unchanged.

Jump to

Keyboard shortcuts

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