From c149ade6a8de9c4ab69b905c4d75b136cfa686c3 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Tue, 25 Nov 2025 13:57:15 +0530 Subject: [PATCH] Add tests related to reasoning param none --- .../chat/test_azure_gpt5_transformation.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/test_litellm/llms/azure/chat/test_azure_gpt5_transformation.py b/tests/test_litellm/llms/azure/chat/test_azure_gpt5_transformation.py index f48d1a1e93..3095ff87f5 100644 --- a/tests/test_litellm/llms/azure/chat/test_azure_gpt5_transformation.py +++ b/tests/test_litellm/llms/azure/chat/test_azure_gpt5_transformation.py @@ -104,17 +104,17 @@ def test_azure_gpt5_codex_series_transform_request(config: AzureOpenAIGPT5Config # GPT-5.1 temperature handling tests for Azure def test_azure_gpt5_1_temperature_with_reasoning_effort_none(config: AzureOpenAIGPT5Config): - """Test that Azure GPT-5.1 supports any temperature when reasoning_effort='none'. + """Test that Azure GPT-5.1 supports any temperature when reasoning_effort='none' and drop_params=True. - Note: Azure OpenAI doesn't support reasoning_effort='none', so it's dropped from the params. - However, the temperature logic still works correctly because the parent treats missing - reasoning_effort the same as 'none' for gpt-5.1. + Note: Azure OpenAI doesn't support reasoning_effort='none', so it's dropped from the params + when drop_params=True. The temperature logic still works correctly because the parent treats + missing reasoning_effort the same as 'none' for gpt-5.1. """ params = config.map_openai_params( non_default_params={"temperature": 0.5, "reasoning_effort": "none"}, optional_params={}, model="azure/gpt-5.1", - drop_params=False, + drop_params=True, api_version="2024-05-01-preview", ) assert params["temperature"] == 0.5 @@ -122,6 +122,18 @@ def test_azure_gpt5_1_temperature_with_reasoning_effort_none(config: AzureOpenAI assert "reasoning_effort" not in params or params.get("reasoning_effort") != "none" +def test_azure_gpt5_1_reasoning_effort_none_error_when_drop_params_false(config: AzureOpenAIGPT5Config): + """Test that Azure GPT-5.1 raises error for reasoning_effort='none' when drop_params=False.""" + with pytest.raises(litellm.utils.UnsupportedParamsError): + config.map_openai_params( + non_default_params={"reasoning_effort": "none"}, + optional_params={}, + model="azure/gpt-5.1", + drop_params=False, + api_version="2024-05-01-preview", + ) + + def test_azure_gpt5_1_temperature_without_reasoning_effort(config: AzureOpenAIGPT5Config): """Test that Azure GPT-5.1 supports any temperature when reasoning_effort is not specified.""" params = config.map_openai_params(