Skip to content

Commit 14b1490

Browse files
authored
OpenAI gpt-5-chat does not support (encrypted) reasoning (#3332)
1 parent dad1994 commit 14b1490

File tree

1 file changed

+5
-2
lines changed
  • pydantic_ai_slim/pydantic_ai/profiles

1 file changed

+5
-2
lines changed

pydantic_ai_slim/pydantic_ai/profiles/openai.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ def __post_init__(self): # pragma: no cover
6262

6363
def openai_model_profile(model_name: str) -> ModelProfile:
6464
"""Get the model profile for an OpenAI model."""
65-
is_reasoning_model = model_name.startswith('o') or model_name.startswith('gpt-5')
65+
is_gpt_5 = model_name.startswith('gpt-5')
66+
is_o_series = model_name.startswith('o')
67+
is_reasoning_model = is_o_series or (is_gpt_5 and 'gpt-5-chat' not in model_name)
68+
6669
# Check if the model supports web search (only specific search-preview models)
6770
supports_web_search = '-search-preview' in model_name
6871

@@ -91,7 +94,7 @@ def openai_model_profile(model_name: str) -> ModelProfile:
9194
json_schema_transformer=OpenAIJsonSchemaTransformer,
9295
supports_json_schema_output=True,
9396
supports_json_object_output=True,
94-
supports_image_output=is_reasoning_model or '4.1' in model_name or '4o' in model_name,
97+
supports_image_output=is_gpt_5 or 'o3' in model_name or '4.1' in model_name or '4o' in model_name,
9598
openai_unsupported_model_settings=openai_unsupported_model_settings,
9699
openai_system_prompt_role=openai_system_prompt_role,
97100
openai_chat_supports_web_search=supports_web_search,

0 commit comments

Comments
 (0)