Function: webSearchTool()
@providerprotocol/ai / openai / webSearchTool
Function: webSearchTool()
Section titled “Function: webSearchTool()”webSearchTool(
options?):OpenAIWebSearchTool
Defined in: src/providers/openai/types.ts:1349
Creates a web search tool configuration for the Responses API.
The web search tool enables the model to search the web for up-to-date information.
Parameters
Section titled “Parameters”options?
Section titled “options?”Optional configuration for search behavior and user location
search_context_size?
Section titled “search_context_size?”"low" | "medium" | "high"
user_location?
Section titled “user_location?”OpenAIWebSearchUserLocation | null
Returns
Section titled “Returns”A web search tool configuration object
Example
Section titled “Example”// Basic web searchconst search = webSearchTool();
// With configurationconst searchWithLocation = webSearchTool({ search_context_size: 'high', user_location: { type: 'approximate', city: 'San Francisco', country: 'US' }});