Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pydantic_ai_slim/pydantic_ai/profiles/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def __post_init__(self): # pragma: no cover

def openai_model_profile(model_name: str) -> ModelProfile:
"""Get the model profile for an OpenAI model."""
is_reasoning_model = model_name.startswith('o') or model_name.startswith('gpt-5')
is_gpt_5 = model_name.startswith('gpt-5')
is_o_series = model_name.startswith('o')
is_reasoning_model = is_o_series or (is_gpt_5 and 'gpt-5-chat' not in model_name)

# Check if the model supports web search (only specific search-preview models)
supports_web_search = '-search-preview' in model_name

Expand Down Expand Up @@ -91,7 +94,7 @@ def openai_model_profile(model_name: str) -> ModelProfile:
json_schema_transformer=OpenAIJsonSchemaTransformer,
supports_json_schema_output=True,
supports_json_object_output=True,
supports_image_output=is_reasoning_model or '4.1' in model_name or '4o' in model_name,
supports_image_output=is_gpt_5 or 'o3' in model_name or '4.1' in model_name or '4o' in model_name,
openai_unsupported_model_settings=openai_unsupported_model_settings,
openai_system_prompt_role=openai_system_prompt_role,
openai_chat_supports_web_search=supports_web_search,
Expand Down