Files
Dmitry Ng 649d2f5b67 fix: normalize multiple tool calls in Bedrock Converse API
- Refactored message normalization in convertMessages to properly handle all variants of multi-tool-call scenarios
- Introduced aiMessageAccumulator to consolidate consecutive AI messages with text, reasoning, and multiple tool calls into a single assistant message
- Introduced toolResultAccumulator to consolidate consecutive tool result messages into a single user message
- Fixed ValidationException when users structure message chains differently (6 possible variants now supported)
- Added comprehensive test TestConverseAPIMultipleToolCallsVariants covering all 6 user-facing message chain patterns
- Added unit tests for message accumulators and conversion logic to ensure robustness
- Updated existing test recordings to reflect normalized message structure

This ensures the Bedrock Converse API receives properly formatted messages regardless of how users structure their multi-turn conversations with tool calls.
2026-03-15 17:10:04 +03:00
..