@langchain/openai
Version:
OpenAI integrations for LangChain.js
1 lines • 4.79 kB
Source Map (JSON)
{"version":3,"file":"webSearch.d.cts","names":["OpenAI","OpenAIClient","ServerTool","WebSearchUserLocation","WebSearchFilters","WebSearchOptions","WebSearchTool","Responses","webSearch"],"sources":["../../src/tools/webSearch.d.ts"],"sourcesContent":["import { OpenAI as OpenAIClient } from \"openai\";\nimport type { ServerTool } from \"@langchain/core/tools\";\n/**\n * User location configuration for geographic search refinement.\n */\nexport interface WebSearchUserLocation {\n /**\n * The type of location. Currently only \"approximate\" is supported.\n */\n type: \"approximate\";\n /**\n * Two-letter ISO country code (e.g., \"US\", \"GB\").\n * @see https://en.wikipedia.org/wiki/ISO_3166-1\n */\n country?: string;\n /**\n * City name (e.g., \"San Francisco\", \"London\").\n */\n city?: string;\n /**\n * Region or state name (e.g., \"California\", \"London\").\n */\n region?: string;\n /**\n * IANA timezone (e.g., \"America/Los_Angeles\", \"Europe/London\").\n * @see https://timeapi.io/documentation/iana-timezones\n */\n timezone?: string;\n}\n/**\n * Domain filtering configuration for web search.\n */\nexport interface WebSearchFilters {\n /**\n * Allow-list of up to 100 domains to limit search results.\n * Omit the HTTP/HTTPS prefix (e.g., \"openai.com\" instead of \"https://openai.com/\").\n * Includes subdomains automatically.\n */\n allowedDomains?: string[];\n}\n/**\n * Options for the OpenAI web search tool.\n */\nexport interface WebSearchOptions {\n /**\n * Domain filtering configuration.\n * Limit results to a specific set of up to 100 domains.\n */\n filters?: WebSearchFilters;\n /**\n * Approximate user location for geographic search refinement.\n * Not supported for deep research models.\n */\n userLocation?: WebSearchUserLocation;\n /**\n * High level guidance for the amount of context window space to use for the\n * search. One of `low`, `medium`, or `high`. `medium` is the default.\n */\n search_context_size?: \"low\" | \"medium\" | \"high\";\n}\n/**\n * OpenAI web search tool type for the Responses API.\n */\nexport type WebSearchTool = OpenAIClient.Responses.WebSearchTool;\n/**\n * Creates a web search tool that allows OpenAI models to search the web\n * for up-to-date information before generating a response.\n *\n * Web search supports three main types:\n * 1. **Non-reasoning web search**: Quick lookups where the model passes queries\n * directly to the search tool.\n * 2. **Agentic search with reasoning models**: The model actively manages the\n * search process, analyzing results and deciding whether to keep searching.\n * 3. **Deep research**: Extended investigations using models like `o3-deep-research`\n * or `gpt-5` with high reasoning effort.\n *\n * @see {@link https://platform.openai.com/docs/guides/tools-web-search | OpenAI Web Search Documentation}\n * @param options - Configuration options for the web search tool\n * @returns A web search tool definition to be passed to the OpenAI Responses API\n *\n * @example\n * ```typescript\n * import { ChatOpenAI, tools } from \"@langchain/openai\";\n *\n * const model = new ChatOpenAI({\n * model: \"gpt-4o\",\n * });\n *\n * // Basic usage\n * const response = await model.invoke(\"What was a positive news story from today?\", {\n * tools: [tools.webSearch()],\n * });\n *\n * // With domain filtering\n * const filteredResponse = await model.invoke(\"Latest AI research news\", {\n * tools: [tools.webSearch({\n * filters: {\n * allowedDomains: [\"arxiv.org\", \"nature.com\", \"science.org\"],\n * },\n * })],\n * });\n *\n * // With user location for geographic relevance\n * const localResponse = await model.invoke(\"What are the best restaurants near me?\", {\n * tools: [tools.webSearch({\n * userLocation: {\n * type: \"approximate\",\n * country: \"US\",\n * city: \"San Francisco\",\n * region: \"California\",\n * timezone: \"America/Los_Angeles\",\n * },\n * })],\n * });\n *\n * // Cache-only mode (no live internet access)\n * const cachedResponse = await model.invoke(\"Find information about OpenAI\", {\n * tools: [tools.webSearch({\n * externalWebAccess: false,\n * })],\n * });\n * ```\n */\nexport declare function webSearch(options?: WebSearchOptions): ServerTool;\n//# sourceMappingURL=webSearch.d.ts.map"],"mappings":";;;;;;;AAKA;AA2BiBI,UA3BAD,qBAAAA,CA2BgB;EAWhBE;AAoBjB;AA4DA;;;;;;;;;;;;;;;;;;;;;;;;UA3FiBD,gBAAAA;;;;;;;;;;;UAWAC,gBAAAA;;;;;YAKHD;;;;;iBAKKD;;;;;;;;;;KAUPG,aAAAA,GAAgBL,QAAAA,CAAaM,SAAAA,CAAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4D3BE,SAAAA,WAAoBH,mBAAmBH"}