fix(openai): update responses API model detection for pro and codex models (#35594)

This commit is contained in:
Mohammad Mohtashim
2026-03-09 18:20:20 +05:00
committed by GitHub
parent f838c78788
commit 3af0bc0141
2 changed files with 24 additions and 2 deletions

View File

@@ -533,10 +533,17 @@ def _handle_openai_api_error(e: openai.APIError) -> None:
raise
_RESPONSES_API_ONLY_PREFIXES = (
"gpt-5-pro",
"gpt-5.2-pro",
"gpt-5.4-pro",
)
def _model_prefers_responses_api(model_name: str | None) -> bool:
if not model_name:
return False
return "gpt-5.2-pro" in model_name or "codex" in model_name
return model_name.startswith(_RESPONSES_API_ONLY_PREFIXES) or "codex" in model_name
_BM = TypeVar("_BM", bound=BaseModel)