fix: add fallback for Azure deployment names in _supports_reasoning_effort_level (fixes #25850)

When Azure deployment names (e.g. gpt-5.1-DataZoneStandard) are used,
the registry lookup in _supports_reasoning_effort_level fails because
these user-defined names don't exist in model_prices_and_context_window.
This caused reasoning_effort='none' to be incorrectly rejected.

Add a string-based fallback that checks known model prefixes (gpt-5.1,
gpt-5.2) when the direct registry lookup returns False, restoring the
1.81.x behaviour for custom deployment names.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Yiyang Liu <37043548+ianliuy@users.noreply.github.com>
This commit is contained in:
Yiyang Liu 2026-04-16 14:16:53 -07:00
parent c0fc4c4234
commit 0a9789249e
No known key found for this signature in database

View file

@ -31,7 +31,20 @@ class AzureOpenAIGPT5Config(AzureOpenAIConfig, OpenAIGPT5Config):
model = "azure/" + model[len(cls.GPT5_SERIES_ROUTE) :]
elif not model.startswith("azure/"):
model = "azure/" + model
return super()._supports_reasoning_effort_level(model, level)
if super()._supports_reasoning_effort_level(model, level):
return True
# Fallback: registry lookup fails for Azure deployment names
# (e.g. "gpt-5.1-DataZoneStandard") that are not in
# model_prices_and_context_window.json. Use string matching as a
# safe fallback, consistent with the behaviour in litellm 1.81.x.
model_name = model.split("/")[-1]
if level == "none":
return model_name.startswith("gpt-5.1") or model_name.startswith(
"gpt-5.2"
)
return False
@classmethod
def is_model_gpt_5_model(cls, model: str) -> bool: