fix(invoke_handler.py): fix converse chunk parsing to only return empty dict on tool use

Fixes https://github.com/BerriAI/litellm/issues/9127
This commit is contained in:
Krrish Dholakia 2025-03-11 22:04:17 -07:00
parent 318a4fd9ed
commit 0b3c58665f
2 changed files with 9 additions and 3 deletions

View file

@ -1231,7 +1231,9 @@ class AWSEventStreamDecoder:
if len(self.content_blocks) == 0:
return False
if "text" in self.content_blocks[0]:
if (
"toolUse" not in self.content_blocks[0]
): # be explicit - only do this if tool use block, as this is to prevent json decoding errors
return False
for block in self.content_blocks: