fix(openai): bridge gpt-5.6+ with tools to /v1/responses even without reasoning_effort

gpt-5.6 family models fail on /v1/chat/completions when function tools are
present because OpenAI applies a default reasoning_effort server-side.
Bridge to /v1/responses unconditionally for is_model_gpt_5_4_plus_model with tools.

Fixes: #33221
This commit is contained in:
Harshvardhan 2026-07-14 22:36:51 +05:30
parent c2141b1113
commit ce3ff5df0f
2 changed files with 13 additions and 2 deletions

View file

@ -1014,8 +1014,10 @@ def responses_api_bridge_check(
and model_info.get("mode") != "responses"
and OpenAIGPT5Config.is_model_gpt_5_model(model)
and not OpenAIGPT5Config.is_model_gpt_5_search_model(model)
and reasoning_effort is not None
and (reasoning_summary is not None or (OpenAIGPT5Config.is_model_gpt_5_4_plus_model(model) and tools))
and (
(reasoning_effort is not None and reasoning_summary is not None)
or (OpenAIGPT5Config.is_model_gpt_5_4_plus_model(model) and tools)
)
):
model_info["mode"] = "responses"
model = model.replace("responses/", "")

View file

@ -0,0 +1,9 @@
"""Regression test for https://github.com/BerriAI/litellm/issues/33221"""
from litellm.main import responses_api_bridge_check
def test_gpt56_tools_bridged_to_responses_without_reasoning_effort():
tools = [{"type": "function", "function": {"name": "get_weather", "description": "Get weather", "parameters": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}}}]
for model in ["gpt-5.6-sol", "gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6"]:
model_info, _ = responses_api_bridge_check(model=model, custom_llm_provider="openai", tools=tools, reasoning_effort=None)
assert model_info.get("mode") == "responses", f"{model} with tools should bridge to responses even without reasoning_effort"