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.
This commit is contained in:
Harshkamdar67 2026-06-27 15:25:08 +05:30
parent 80d3b69d9c
commit ec962437af
2 changed files with 19 additions and 2 deletions

View file

@ -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

View file

@ -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