From 1172a18211e4b9c89b37e5835033d1345fce8b86 Mon Sep 17 00:00:00 2001 From: Warren Date: Thu, 21 May 2026 15:52:33 -0700 Subject: [PATCH] Cover explicit tool choice with parallel calls --- .../chat/test_converse_transformation.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py b/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py index ce8e4f09c3f..eca225bfddf 100644 --- a/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py +++ b/tests/test_litellm/llms/bedrock/chat/test_converse_transformation.py @@ -3794,29 +3794,35 @@ def test_parallel_tool_calls_true_includes_type_field(): assert "parallel_tool_calls" not in request_data["additionalModelRequestFields"] +@pytest.mark.parametrize( + ("parallel_tool_calls", "disable_parallel_tool_use"), + [(True, False), (False, True)], + ids=["parallel-enabled", "parallel-disabled"], +) @pytest.mark.parametrize( ("openai_tool_choice", "expected_anthropic_tool_choice"), [ ( "auto", - {"type": "auto", "disable_parallel_tool_use": True}, + {"type": "auto"}, ), ( "required", - {"type": "any", "disable_parallel_tool_use": True}, + {"type": "any"}, ), ( {"type": "function", "function": {"name": "get_weather"}}, { "type": "tool", "name": "get_weather", - "disable_parallel_tool_use": True, }, ), ], ids=["auto", "required", "named-tool"], ) def test_parallel_tool_calls_moves_explicit_tool_choice_into_anthropic_extension( + parallel_tool_calls, + disable_parallel_tool_use, openai_tool_choice, expected_anthropic_tool_choice, ): @@ -3829,7 +3835,7 @@ def test_parallel_tool_calls_moves_explicit_tool_choice_into_anthropic_extension non_default_params={ "tools": _TOOL_PARAM, "tool_choice": openai_tool_choice, - "parallel_tool_calls": False, + "parallel_tool_calls": parallel_tool_calls, }, optional_params={}, model=model, @@ -3844,6 +3850,10 @@ def test_parallel_tool_calls_moves_explicit_tool_choice_into_anthropic_extension headers={}, ) + expected_anthropic_tool_choice = { + **expected_anthropic_tool_choice, + "disable_parallel_tool_use": disable_parallel_tool_use, + } assert ( request_data["additionalModelRequestFields"]["tool_choice"] == expected_anthropic_tool_choice