Skip to content

Add ThinkingConfig effort<->budget cross-axis derivation (v0.6.10)#32

Open
Esity wants to merge 1 commit into
mainfrom
feat/thinking-effort-budget-derivation
Open

Add ThinkingConfig effort<->budget cross-axis derivation (v0.6.10)#32
Esity wants to merge 1 commit into
mainfrom
feat/thinking-effort-budget-derivation

Conversation

@Esity

@Esity Esity commented Jul 9, 2026

Copy link
Copy Markdown

What

Adds two derived accessors to Canonical::ThinkingConfig so provider translators can always get the thinking axis they need, regardless of which axis the client supplied.

  • #resolved_budget — returns the explicit budget if set, otherwise derives a token budget from effort (for providers like Anthropic that need budget_tokens).
  • #resolved_effort — returns the explicit effort if set, otherwise derives an effort level from budget (for providers like OpenAI that need effort).

Why (SSOT / one oracle)

Each client dialect supplies only ONE thinking axis: Anthropic sends budget_tokens, OpenAI sends effort. But a provider translator on the other side of a route may need the OTHER axis. Without a bridge, thinking gets silently dropped on cross-provider routes (e.g. a Claude budget request routed to an OpenAI backend that only understands effort).

Rather than scatter band constants across provider gems, both directions are driven by a single EFFORT_BUDGET map — one oracle for the conversion:

  • effort -> budget (exact): low = 1024, medium = 8192, high = 16384.
  • budget -> effort (by band boundary): < 8192 -> low, < 16384 -> medium, else high.

Guarantees

  • Explicitly-set values always win over derivation.
  • Both accessors return nil when neither axis is configured.
  • to_h stays faithful to what was actually set — it never fabricates the missing axis. Derivation is opt-in via resolved_*.

Scope

This is the foundation only. A follow-up will wire the provider translators (openai / anthropic / bedrock) to call resolved_* so thinking is no longer dropped on cross-provider routes.

🤖 Generated with Claude Code

A client dialect supplies only ONE thinking axis: Anthropic sends
budget_tokens, OpenAI sends effort. A provider translator may need the
OTHER axis than the one the client gave. Add #resolved_budget and
#resolved_effort so any translator can ask for whichever axis it needs
and always get a usable value, keeping thinking alive across every
client x provider pair instead of silently dropping it.

Both directions are driven by a single EFFORT_BUDGET map (SSOT / one
oracle) rather than duplicating band constants: effort -> budget is
exact (low=1024, medium=8192, high=16384); budget -> effort maps by
band boundary. Explicitly-set values always win over derivation; both
accessors return nil when neither axis is set. to_h stays faithful to
what was actually set and never fabricates the missing axis.

Foundation for wiring the provider translators so thinking is not
dropped on cross-provider routes (e.g. Claude budget -> OpenAI effort).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant