mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-28 01:32:17 +00:00
fix(gpt5): enforce supports_none_reasoning_effort=false gate for reasoning_effort=none
The model map carries supports_none_reasoning_effort for gpt-5 and gpt-5-mini (both false), but the gating block in map_openai_params had branches for xhigh (opt-in) and minimal/low (opt-out) with no branch for none. The missing gate meant none was forwarded to the provider regardless of the map, producing a provider 400 that litellm had all the information to prevent. Add an elif effective_effort == "none" branch that mirrors the minimal/low opt-out pattern: pass through when the map is silent, raise UnsupportedParamsError (400) or drop the param when the map explicitly sets supports_none_reasoning_effort=false. This makes the three opt-out effort levels (minimal, low, none) consistent: all three now gate on the explicit-false map entry rather than having none silently ignored. Fixes #40472. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
328a5f5d60
commit
141582c3d3
1 changed files with 14 additions and 0 deletions
|
|
@ -300,6 +300,20 @@ class OpenAIGPT5Config(OpenAIGPTConfig):
|
|||
message=(f"reasoning_effort={effective_effort} is not supported for this model."),
|
||||
status_code=400,
|
||||
)
|
||||
elif effective_effort == "none":
|
||||
# none is opt-out: unknown models pass through; only block when
|
||||
# the model map explicitly sets supports_none_reasoning_effort=false.
|
||||
# gpt-5 and gpt-5-mini are both marked supports_none_reasoning_effort=false
|
||||
# and OpenAI returns 400 for none on those models.
|
||||
if self._is_reasoning_effort_level_explicitly_disabled(model, effective_effort):
|
||||
if litellm.drop_params or drop_params:
|
||||
non_default_params.pop("reasoning_effort", None)
|
||||
optional_params.pop("reasoning_effort", None)
|
||||
else:
|
||||
raise litellm.utils.UnsupportedParamsError(
|
||||
message=(f"reasoning_effort={effective_effort} is not supported for this model."),
|
||||
status_code=400,
|
||||
)
|
||||
|
||||
################################################################
|
||||
# max_tokens is not supported for gpt-5 models on OpenAI API
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue