mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
When the Responses API converts function_call and message output items into chat completion messages, they can become two consecutive assistant messages. The Bedrock Converse transformer merges these into one, but the merge preserves input order — so if function_call came first, the toolUse block ends up before the text block. Claude models (Sonnet 4, Haiku 3.5+) reject this ordering with: "tool_use ids were found without tool_result blocks immediately after" Add _sort_bedrock_assistant_content_blocks() that reorders content blocks within assistant messages: reasoningContent → text → toolUse. Applied in both sync and async Bedrock Converse transformation paths. Fixes #24361 |
||
|---|---|---|
| .. | ||
| test_anthropic_dedup_factory.py | ||
| test_bedrock_converse_dedup_factory.py | ||