-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Initial Checks
- I confirm that I'm using the latest version of Pydantic AI
- I confirm that I searched for my issue in https://github.com/pydantic/pydantic-ai/issues before opening this issue
Description
See https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat.
When using it with another model, we get this error:
pydantic_ai.exceptions.ModelHTTPError: status_code: 400, model_name: gpt-5, body: {'message': "Unknown parameter: 'web_search_options'.", 'type': 'invalid_request_error', 'param': 'web_search_options', 'code': 'unknown_parameter'}
We should use the model profile to proactively raise an error telling the user to use OpenAIResponsesModel
instead if they're using the web search tool, unless they're using one of those specific models.
Example Code
from pydantic_ai import Agent, WebSearchTool
dinner_choosing_agent = Agent(
model='openai:gpt-5',
instructions="""Do what the user requests""",
builtin_tools=[WebSearchTool()]
)
dinner_choosing_agent.run_sync('Help me find a thai restaurant near Mexico City')
Python, Pydantic AI & LLM client version
v1.0.1
miikargh