From 655815664245a05a8e9d7825f22e24bc942a356f Mon Sep 17 00:00:00 2001 From: pazevedo-hyland Date: Mon, 15 Sep 2025 19:23:39 +0100 Subject: [PATCH] Fix: handle empty arguments in Bedrock tool call invocation --- litellm/litellm_core_utils/prompt_templates/factory.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index 2adddd52e74..65f49cf08b8 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -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 )