Merge pull request #14583 from pazevedo-hyland/fix/bedrock_convert_layer

Fix: handle empty arguments in Bedrock tool call invocation
This commit is contained in:
Krish Dholakia 2025-09-15 20:57:45 -07:00 committed by GitHub
commit 9d2cce43ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2680,7 +2680,10 @@ def _convert_to_bedrock_tool_call_invoke(
id = tool["id"]
name = tool["function"].get("name", "")
arguments = tool["function"].get("arguments", "")
arguments_dict = json.loads(arguments) if arguments else {}
if not arguments or not arguments.strip():
arguments_dict = {}
else:
arguments_dict = json.loads(arguments)
bedrock_tool = BedrockToolUseBlock(
input=arguments_dict, name=name, toolUseId=id
)