mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
fix(openai): update responses API model detection for pro and codex models (#35594)
This commit is contained in:
committed by
GitHub
parent
f838c78788
commit
3af0bc0141
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user