From ec962437af302e4bcdb754b4e405b9cf21a67b1d Mon Sep 17 00:00:00 2001 From: Harshkamdar67 Date: Sat, 27 Jun 2026 15:25:08 +0530 Subject: [PATCH] fix(azure): stop duplicating logprobs params for gpt-5.2 and gpt-5.4 AzureOpenAIGPT5Config.get_supported_openai_params appended logprobs and top_logprobs for gpt-5.2/5.4 unconditionally, but the base OpenAI gpt-5 config already includes them for models that support reasoning_effort='none'. The result was each param listed twice in the supported-params output. Append only when missing, matching the tool_choice guard above it, so the list stays deduplicated while still covering the case where the base config omitted them. --- .../llms/azure/chat/gpt_5_transformation.py | 3 +-- .../chat/test_azure_gpt5_transformation.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/litellm/llms/azure/chat/gpt_5_transformation.py b/litellm/llms/azure/chat/gpt_5_transformation.py index e94f50380c0..33bab2eb0d6 100644 --- a/litellm/llms/azure/chat/gpt_5_transformation.py +++ b/litellm/llms/azure/chat/gpt_5_transformation.py @@ -84,8 +84,7 @@ class AzureOpenAIGPT5Config(AzureOpenAIConfig, OpenAIGPT5Config): ) and not self.is_model_gpt_5_2_model(model): params = [p for p in params if p not in ["logprobs", "top_logprobs"]] elif self.is_model_gpt_5_2_model(model): - azure_supported_params = ["logprobs", "top_logprobs"] - params.extend(azure_supported_params) + params.extend(p for p in ("logprobs", "top_logprobs") if p not in params) return params 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 83562331b9a..b267f5b5cbb 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 @@ -299,3 +299,21 @@ def test_azure_gpt5_1_does_not_support_logprobs(config: AzureOpenAIGPT5Config): supported_params = config.get_supported_openai_params(model="gpt-5.1") assert "logprobs" not in supported_params assert "top_logprobs" not in supported_params + + +@pytest.mark.parametrize( + "model", + ["gpt-5.2", "azure/gpt-5.2", "gpt5_series/gpt-5.2", "azure/gpt-5.4"], +) +def test_azure_gpt5_2_logprobs_not_duplicated( + config: AzureOpenAIGPT5Config, model: str +): + """Regression: gpt-5.2/5.4 must list logprobs and top_logprobs exactly once. + + These models support reasoning_effort="none", so the base config already + includes the logprobs params; the Azure override must not append a second + copy. + """ + supported_params = config.get_supported_openai_params(model=model) + assert supported_params.count("logprobs") == 1 + assert supported_params.count("top_logprobs") == 1