fix(bedrock): pop None context_management before sending to Bedrock Converse

If context_management is forwarded as None (e.g. when mapping returns
None for an invalid format), _filter_context_management_for_bedrock_converse
previously returned early without removing the key, leaving
"context_management": null in the request and causing a validation
error. Pop the key when the value is not a dict.

Co-authored-by: Yassin Kortam <yassin@berri.ai>
This commit is contained in:
Cursor Agent 2026-05-25 12:30:37 +00:00
parent 76ca5ca424
commit 88639d221f
No known key found for this signature in database

View file

@ -1460,6 +1460,7 @@ class AmazonConverseConfig(BaseConfig):
"""Keep only compact_20260112 edits for Bedrock; add beta header or drop field."""
cm = additional_request_params.get("context_management")
if not isinstance(cm, dict):
additional_request_params.pop("context_management", None)
return
edits = cm.get("edits")
if not isinstance(edits, list):