fix(bedrock): strip client_metadata from converse additionalModelRequestFields - #35967
Conversation
…estFields Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Greptile SummaryThe PR prevents Codex’s unsupported
Confidence Score: 5/5The PR appears safe to merge, with the unsupported metadata removed from every Bedrock Converse request-construction path. The exact field is removed before additional model request fields are serialized, both synchronous and asynchronous paths use that transformation, and the regression test confirms legitimate passthrough data remains intact.
|
| Filename | Overview |
|---|---|
| litellm/llms/bedrock/chat/converse_transformation.py | Safely removes the unsupported field from the common synchronous and asynchronous Converse request-building path. |
| tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py | Adds focused regression coverage that verifies the offending field is removed without dropping a valid passthrough field. |
Reviews (1): Last reviewed commit: "fix(bedrock): strip client_metadata from..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Do we have plans on reviewing and getting this into main? |
TLDR
Problem this solves:
client_metadata, Bedrock Converse rejects the calldrop_paramsnever removed it, so the route was unusableHow it solves it:
client_metadatafromadditionalModelRequestFieldsin ConverseRelevant issues
Linear ticket
Resolves LIT-5232
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays 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
Codex is the only client that sends
client_metadata, so the failure only shows up on Codex -> proxy -> Bedrock. Converse forwards anything it doesn't recognize asadditionalModelRequestFields, Bedrock hands that to the model verbatim, and Anthropic answers withclient_metadata: Extra inputs are not permittedProxy config used for both runs:
Same curl for both runs, the exact body Codex sends:
Before, at 0659738, the request the proxy builds for Bedrock (from
--detailed_debug,drop_params: trueactive and not helping):After, at cdac5fd, same curl, no passthrough field left for Bedrock to reject:
Both runs stopped at Bedrock auth: the AWS credentials I have access to are no longer authorized for
bedrock:InvokeModelon this account, so I could not get a paid 200 back. The before/after difference is in the request LiteLLM signs and sends, which is exactly the field Bedrock was rejecting, so someone with working Bedrock credentials can confirm the 200 in a minuteUntil a release ships,
additional_drop_params: ["client_metadata"]on the model works as a config-only workaround, and it stays a valid escape hatch afterwardsType
🐛 Bug Fix
Changes
AmazonConverseConfig._prepare_request_paramsdropsclient_metadatanext to where it already dropsparallel_tool_calls, so it never reachesadditionalModelRequestFields.AnthropicConfig.transform_requestdoes the same thing for the direct Anthropic, Vertex, and Bedrock invoke paths, this closes the one remaining holeNote that
drop_paramsis the wrong lever here and always was: it only governs known OpenAI params a provider does not support, whileclient_metadatais not an OpenAI param, so it flows through the provider-specific passthrough insteadFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/e57cd0ce775749e595f7da41d0795378