Skip to content

Function: webSearchTool()

@providerprotocol/ai


@providerprotocol/ai / openai / 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.

Optional configuration for search behavior and user location

"low" | "medium" | "high"

OpenAIWebSearchUserLocation | null

OpenAIWebSearchTool

A web search tool configuration object

// Basic web search
const search = webSearchTool();
// With configuration
const searchWithLocation = webSearchTool({
search_context_size: 'high',
user_location: {
type: 'approximate',
city: 'San Francisco',
country: 'US'
}
});