From be9053d95763d4ff4e7f9e89d505163b0d42b5fc Mon Sep 17 00:00:00 2001 From: Yuneng Jiang Date: Tue, 14 Apr 2026 19:10:55 -0700 Subject: [PATCH] [Test] mark bedrock gpt-oss function-calling stream test flaky Bedrock GPT-OSS occasionally emits truncated toolUse.input deltas (e.g. accumulated args of '{"":"'), which causes test_function_calling_with_tool_response to hard-fail on json.loads. Other overrides in TestBedrockGPTOSS already handle similar model-side flakiness; apply retries=6 delay=5 scoped to this subclass so other providers keep strict behavior. --- tests/llm_translation/test_bedrock_gpt_oss.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/llm_translation/test_bedrock_gpt_oss.py b/tests/llm_translation/test_bedrock_gpt_oss.py index 455c5c62b5..c21db7c772 100644 --- a/tests/llm_translation/test_bedrock_gpt_oss.py +++ b/tests/llm_translation/test_bedrock_gpt_oss.py @@ -16,11 +16,16 @@ class TestBedrockGPTOSS(BaseLLMChatTest): return { "model": "bedrock/converse/openai.gpt-oss-20b-1:0", } - + def test_tool_call_no_arguments(self, tool_call_no_arguments): """Test that tool calls with no arguments is translated correctly. Relevant issue: https://github.com/BerriAI/litellm/issues/6833""" pass + @pytest.mark.flaky(retries=6, delay=5) + def test_function_calling_with_tool_response(self): + """Bedrock GPT-OSS intermittently streams truncated toolUse.input deltas, producing malformed JSON args. Retry to tolerate model flakiness.""" + super().test_function_calling_with_tool_response() + def test_prompt_caching(self): """ Remove override once we have access to Bedrock prompt caching @@ -33,10 +38,13 @@ class TestBedrockGPTOSS(BaseLLMChatTest): """ pass - @pytest.mark.parametrize("model", [ - "bedrock/openai.gpt-oss-20b-1:0", - "bedrock/openai.gpt-oss-120b-1:0", - ]) + @pytest.mark.parametrize( + "model", + [ + "bedrock/openai.gpt-oss-20b-1:0", + "bedrock/openai.gpt-oss-120b-1:0", + ], + ) def test_reasoning_effort_transformation_gpt_oss(self, model): """Test that reasoning_effort is handled correctly for GPT-OSS models.""" config = AmazonConverseConfig() @@ -51,7 +59,7 @@ class TestBedrockGPTOSS(BaseLLMChatTest): model=model, drop_params=False, ) - + # GPT-OSS should have reasoning_effort in result, not thinking assert "reasoning_effort" in result assert result["reasoning_effort"] == "low"