Repository navigation
fix(anthropic): carry the adaptive effort tier to every bridged Claude target - #38533
Conversation
|
@greptileai can you reply here with a score and why that score? |
|
bugbot run |
|
Score: 4.5/5 No blocking issues found. The change is narrowly scoped and correctly preserves The only deduction is validation confidence: Bedrock is verified through |
Greptile SummaryThe PR carries adaptive effort tiers through bridged Claude targets while preserving Bedrock’s
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported Databricks rejection is fixed by retaining a plain string effort tier, and the added Bedrock wire-level and live Converse evidence closes the earlier validation gap.
|
| Filename | Overview |
|---|---|
| litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py | Separates Bedrock and other bridged Claude effort carriers and correctly avoids summary-wrapping the string tier that previously broke Databricks. |
| tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_anthropic_experimental_pass_through_adapters_transformation.py | Adds focused regression coverage for provider wire shapes, all effort tiers, summary-bearing requests, Bedrock ARNs, and no-tier behavior. |
Reviews (2): Last reviewed commit: "fix(anthropic): carry the adaptive effor..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
3f3ea7a to
3193e4f
Compare
|
Confirmed and fixed in 3193e4f. Bedrock also dropped output_config with the wrapped dict, so the tier stays a plain string for Claude targets. |
|
@greptileai can you reply here with a score and why that score? |
|
bugbot run |
|
Score: 4/5. The fix is well-scoped and the core translation is correct: adaptive The regression coverage is strong: all effort tiers, bare adaptive thinking, budget-based thinking, summary wrapping, the Bedrock payload path, and the non-Claude path are covered. I’m stopping at 4 rather than 5 because Bedrock coverage is indirect ( |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 3193e4f. Configure here.
3193e4f to
673610a
Compare
|
Tightened the wire assertions to the exact tier each provider sends, so a mapping that changed the value now fails instead of passing. |
|
@greptileai can you reply here with a score and why that score? |
|
bugbot run |
|
Score: 4/5. This is a well-scoped and well-tested fix. The bridge now carries adaptive The tests cover all effort tiers, no-tier and budgeted cases, summary-bearing requests, and the Bedrock/Databricks/OpenRouter mappings. I’m not giving 5/5 only because this changes a shared translation path across several bridged providers, while Bedrock is validated through |
…e target /v1/messages forwarded `thinking` verbatim for a Claude-family model and then returned, carrying `output_config.effort` only when the model string started with a Bedrock prefix. Every other bridged provider got a bare adaptive thinking block, so the caller's effort did nothing: max and minimal produced byte-identical upstream bodies. Send those targets the tier as `reasoning_effort`, which is the param they take. Bedrock keeps taking `output_config`, since the two are not interchangeable there: an application inference profile ARN resolves to no chat config, so `reasoning_effort` is dropped and the tier vanishes, and a provider that rebuilds `output_config` from it overwrites a caller-set `thinking.display` on the way. The tier stays a plain string, the summary already travelling inside the forwarded `thinking` block. Adaptive with no tier, and budgeted thinking, both stay exactly as they were.
673610a to
b6f0216
Compare
|
@greptileai can you reply here with a score and why that score? |
|
bugbot run |
|
Confidence score: 4/5. I found no blocking correctness issues. The change cleanly separates the two required paths: Bedrock keeps I’m not giving 5/5 because the Bedrock behavior is validated through |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b6f0216. Configure here.
|
@greptileai a live Bedrock leg now backs the proof section, Case 3, real Converse deployment. Can you re-score with that gap closed? |
TLDR
Problem this solves:
/v1/messagesdropped the effort tier for bridged Claude modelsmaxandminimalproduced byte-identical upstream bodiesHow it solves it:
reasoning_effort, the param they takeoutput_config, which the two are not interchangeable forreasoning_effortwould be dropped thereUser Flow
Before: a developer pointing Claude Code at a Claude model served through openrouter gets the same answer no matter which effort they pick
openrouter/anthropic/claude-opus-4.7and confirms it serves traffic"thinking": {"type": "adaptive"}and"output_config": {"effort": "max"}"effort": "minimal", expecting a faster and cheaper answerAfter: the tier the developer picks is the tier the provider is told
"effort": "max""effort": "minimal"and the provider is told to run at its lowestRelevant issues
Linear ticket
Pre-Submission checklist
Screenshots / Proof of Fix
Shared setup, identical for both runs. A local proxy holding the same Claude model on three provider shapes, all pointed at a local stub that records the body it received:
Substitution declared: no key on this account carries these deployments, so the upstream is a local stub. The question here is which body the gateway decided to send, and the stub records exactly that. Bedrock does get a live leg, Case 3 below: a real
us.anthropic.claude-opus-4-8deployment on Bedrock Converse in us-east-1, hit with real credentials, with the request body the proxy sent taken from--detailed_debugoutput. Its config:Before (cd63c7e)
Case 1: /v1/messages
/v1/messagesconfig, so they never reach the bridge this PR changesCase 2: /v1/chat/completions, the same models
reasoning_effort:Case 3: /v1/messages against live Bedrock
https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-opus-4-8/converse:thinkingblock followed bytext, at 444 output tokens formaxand 220 forlow, so the tier already travels here: this is the carve-out the PR preservesAfter (b6f0216)
Case 1: /v1/messages
maxarrives asxhighandminimalaslowbecause openrouter's own param mapping and the model's declared levels remap them, which is the same treatment/v1/chat/completionsgivesCase 2: /v1/chat/completions, the same models
Case 3: /v1/messages against live Bedrock
"effort": "high"maxran at 423 output tokens andlowat 187, both with athinkingblock, and untiered adaptive stayed bare at 178, leaving Bedrock's own default in chargethinkingcontent block thentextover SSE and ended cleanly withmessage_stopat 178 output tokens"effort": "minimal"came back 400 withInvalid reasoning_effort/output_config.effort value: 'minimal'. Must be one of: 'low', 'medium', 'high', 'xhigh', or 'max'.Case 4: /v1/messages against live Vertex AI Claude, native path untouched
maxandlowrequests against a realvertex_ai/claude-sonnet-4-6deployment in us-east5, on both this commit and the merge base.../publishers/anthropic/models/claude-sonnet-4-6:rawPredictwith'thinking': {'type': 'adaptive'}, 'output_config': {'effort': ...}carried verbatim, because vertex has a native/v1/messagesconfig and never enters the bridgeType
🐛 Bug Fix
Caveats (if any)
Medium
thinking.displayfor the tierreasoning_effort, replacingdisplayoutput_config, so this bridge cannot send it the inert carrieroutput_configdirectly_apply_reasoning_summary_wrappingturns the tier into{"effort": ..., "summary": ...}Invalid reasoning_efforton the dict, and bedrock dropsoutput_configwith itthinking, so the tier stays a plain string thereget_optional_paramsregression testsLow
/v1/messagesconfig that never reach this code, 78 bridgedreasoning_effortare databricks (15) and openrouter (13)thinkingon this path today withdrop_paramsoff, so nothing regressestests/test_litellm/llms/bedrock/files/test_bedrock_files_transformation.pyhas 5 collection errorsFinal Attestation
Note
Medium Risk
Changes request shaping for bridged Claude
/v1/messagescalls (reasoning depth/cost behavior), with a known databricks trade-off wherethinking.displaymay be rewritten when the tier is mapped viareasoning_effort.Overview
Fixes
/v1/messagesadaptive thinking sooutput_config.effortis not dropped for Claude models routed through non-Bedrock bridges (e.g. openrouter, databricks). Previously only Bedrock gotoutput_config; other bridged targets forwardedthinkingalone, somaxandminimalcould produce identical upstream bodies.Bedrock (including inference-profile ARNs) is unchanged:
thinkingstays verbatim and effort still goes asoutput_config(minusformat). Other bridged Claude targets now also setreasoning_effortfrom the declared adaptive tier (plain string—no summary dict, sincethinking.summaryis already forwarded). Budgetedenabledthinking is not coarsened into a tier; adaptive requests without an effort tier still omit both carriers.Regression tests assert adapter output and, where relevant,
get_optional_paramswire shapes (ARNoutput_config, preservedthinking.displayon Bedrock, databricks display trade-off documented).Reviewed by Cursor Bugbot for commit b6f0216. Bugbot is set up for automated code reviews on this repo. Configure here.
Link to Devin session: https://app.devin.ai/sessions/6b3fde4eddf94860ae912165e0b7283b
Open in Devin Desktop: https://app.devin.ai/desktop/session/6b3fde4eddf94860ae912165e0b7283b?variant=devin