Repository navigation
fix(bedrock): use base_model for Claude capability checks on application inference profile ARNs - #46569
Conversation
…ion inference profile ARNs An application inference profile ARN names no model, so Converse looked up the ARN, found nothing, and rewrote adaptive thinking to a fixed budget that Opus 4.8 rejects. Converse now resolves capabilities through the deployment's base_model (model_info or litellm_params) for these ARNs, and warns when it has to fall back without one.
… types Keeps the basedpyright gate flat after reading base_model from litellm_params
|
@greptileai review |
|
bugbot run |
|
@litereview code-review |
| if capped is not None: | ||
| optional_params["thinking"] = capped | ||
| if is_bedrock_application_inference_profile_arn(model): | ||
| litellm.verbose_logger.warning(ADAPTIVE_THINKING_ON_UNRESOLVED_ARN_WARNING, model) |
Merging this PR will not alter performance
|
[Medium impact] This PR appears safe to merge; no outstanding actionable findings remain. SummaryThis PR uses
Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
✅ code-review5/5 · Ready for human reviewScope: full · Full PR review. No correctness findings. Checks and execution details
Manual E2E evidence (PR description): real Bedrock calls in us-east-1 against a temporary application inference profile copied from
Automated tests: new Router-level tests in Result: I ran both test files on the head checkout and got
The first run had 3 failures from
View review · Reviewed |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…e_model An application inference profile ARN that sets supports_prompt_cache_breakpoint keeps that answer, and base_model only decides when the deployment sets nothing
|
@greptileai re review |
|
bugbot run |
… then base_model Marker support and 1h ttl support now each ask the configured ARN before its base_model, so a deployment override no longer hides the base model's ttl support
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> # Conflicts: # litellm/litellm_core_utils/prompt_templates/factory.py
|
Bugbot run |
|
@greptileai re review |
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 9f30b92. Configure here.
TLDR
Problem this solves:
thinkingon an Opus 4.8 ARN gets rewritten into a fixed budgetbase_modelon the deployment did nothingHow it solves it:
base_modelwhen the model is an app profile ARNbase_model(markers and 1h ttl)base_modelkeeps today's behavior and logs a warning saying to set itUser Flow
Before: a team calling Opus 4.8 through an application inference profile ARN silently gets Sonnet answers instead
model: bedrock/arn:aws:bedrock:...:application-inference-profile/...,model_info.base_model: us.anthropic.claude-opus-4-8, and a fallback to Sonnet 4.6"thinking": {"type": "adaptive"}"thinking.type.enabled" is not supported for this modelx-litellm-attempted-fallbacks: 1and"model": "us.anthropic.claude-sonnet-4-6"After: the same request is answered by Opus through the ARN
base_model"thinking": {"type": "adaptive"}x-litellm-model-idof the ARN deployment andx-litellm-attempted-fallbacks: 0base_modeloff, the call still 400s like before and the proxy log now says to setbase_modelLinear ticket
Resolves LIT-9588
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Real Bedrock calls in us-east-1 against a temporary application inference profile copied from
us.anthropic.claude-opus-4-8. The account id is masked as<acct>and the profile id as<profile-id>, since the profile was recreated between the two runs. Proxy configBefore ran from the merge base on port 4589 and After from the tip on port 4588, both with this config. Each case runs this request with only
modelchanged, and the output is trimmed to the status line, the routing headers and the start of the bodyBefore (0c91bd7)
ARN with base_model
"model": "opus48"ARN without base_model
"model": "opus48-no-base-model"After (17d4074)
ARN with base_model
"model": "opus48"ARN without base_model
"model": "opus48-no-base-model"Type
Bug Fix
Caveats (if any)
Medium
Unknown provider=None, tracked outside this PRbase_modelstill gets the budget rewrite, now with a warningNote
Medium Risk
Touches core Bedrock Converse request assembly and caching/thinking gates; behavior changes only for application inference profile ARNs when base_model is set, but misconfigured base_model could send wrong params to Bedrock.
Overview
Bedrock application inference profile ARNs do not embed a model id, so LiteLLM was treating them as unknown for Converse capability logic (adaptive thinking, prompt-cache
cachePointblocks, extended TTL, and related param mapping).This change introduces
bedrock_capability_model, which resolves capabilities from the deployment’sbase_model(fromlitellm_paramsormodel_info) when the request model is an app-profile ARN; named model ids are unchanged. Converse sync/async request transforms use that id for thinking and tool behavior while still passing the configured deployment model (deployment_model) into cache-point helpers so per-deployment flags likesupports_prompt_cache_breakpointwin over the base model.bedrock_model_accepts_cache_pointsandbedrock_cache_point_ttl_supportednow consider deployment settings first, then the capability model. The samedeployment_modelthreading applies through message/tool conversion (get_cache_point_block,_bedrock_tools_pt, etc.).map_openai_paramsfor the converse route uses the capability model for mapping. When adaptive thinking is coerced to a fixed budget on an ARN with nobase_model, a warning tells operators to setbase_model.Unit tests cover routed profile ARNs for adaptive thinking, disabled thinking, cache points, and the new helper.
Reviewed by Cursor Bugbot for commit 9f30b92. Bugbot is set up for automated code reviews on this repo. Configure here.