diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py index e95718469a6..f42c912ee14 100644 --- a/litellm/litellm_core_utils/prompt_templates/factory.py +++ b/litellm/litellm_core_utils/prompt_templates/factory.py @@ -5361,7 +5361,9 @@ def make_valid_bedrock_tool_name(input_tool_name: str) -> str: return valid_string -def make_valid_bedrock_tool_use_id(input_tool_use_id: str) -> str: +def make_valid_bedrock_tool_use_id( + input_tool_use_id: Optional[str], +) -> Optional[str]: """ Replaces any invalid characters in the input tool_use_id with underscores so it matches Bedrock Converse's required pattern ``^[a-zA-Z0-9_.:-]+$``. diff --git a/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_factory.py b/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_factory.py index 21ddef03dca..eeb59a3e0c1 100644 --- a/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_factory.py +++ b/tests/test_litellm/litellm_core_utils/prompt_templates/test_litellm_core_utils_prompt_templates_factory.py @@ -2818,7 +2818,7 @@ def test_make_valid_bedrock_tool_use_id_empty_passthrough(): ) assert make_valid_bedrock_tool_use_id("") == "" - assert make_valid_bedrock_tool_use_id(None) is None # type: ignore[arg-type] + assert make_valid_bedrock_tool_use_id(None) is None def test_bedrock_tool_call_invoke_sanitizes_drifted_name_and_id():