Skip to content

Fix reasoning effort loss in cross-provider thinking conversion#120

Open
Matt Perpick (clutchski) wants to merge 1 commit intomainfrom
matt/fuzzier
Open

Fix reasoning effort loss in cross-provider thinking conversion#120
Matt Perpick (clutchski) wants to merge 1 commit intomainfrom
matt/fuzzier

Conversation

@clutchski
Copy link
Contributor

Summary

  • Fixed incorrect reasoning effort levels when converting Anthropic/Bedrock thinking.budget_tokens to universal format. The budget_to_effort heuristic was using DEFAULT_MAX_TOKENS (4096) instead of the actual request max_tokens, causing effort "high" or "medium" to become "low" when max_tokens was small.
  • Added From<(&Thinking, Option<i64>)> impl that accepts max_tokens context, updated both Anthropic and Bedrock adapters.
  • Added thinkingEnabledParam test case to payload snapshots and cross-provider test to reproduce the bug.

Test plan

  • Unit test reproducing the bug: test_anthropic_thinking_to_openai_effort_with_small_max_tokens
  • New From impl unit test: test_from_anthropic_thinking_without_max_tokens_uses_default
  • All 554 lib tests pass
  • Cross-provider coverage test passes with new thinkingEnabledParam case
  • Snapshot payloads added for chat-completions, responses, and anthropic

🤖 Generated with Claude Code

…ersion

When converting Anthropic `thinking.budget_tokens` to universal `ReasoningConfig`,
the budget→effort heuristic used DEFAULT_MAX_TOKENS (4096) instead of the actual
request max_tokens. This caused incorrect effort levels when max_tokens differed
from the default (e.g., budget=1024 with max_tokens=1024 → High, not Low).

Added `From<(&Thinking, Option<i64>)>` impl that accepts max_tokens context, and
updated both Anthropic and Bedrock adapters to pass actual max_tokens.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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