{"version":3,"file":"webSearch.cjs","names":[],"sources":["../../src/tools/webSearch.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { type ServerTool } from \"@langchain/core/tools\";\n\n/**\n * Options for the web search tool.\n */\nexport interface WebSearch20250305Options {\n  /**\n   * Maximum number of times the tool can be used in the API request.\n   */\n  maxUses?: number;\n  /**\n   * If provided, only these domains will be included in results. Cannot be used\n   * alongside `blocked_domains`.\n   */\n  allowedDomains?: string[];\n  /**\n   * If provided, these domains will never appear in results. Cannot be used\n   * alongside `allowed_domains`.\n   */\n  blockedDomains?: string[];\n  /**\n   * Create a cache control breakpoint at this content block.\n   */\n  cacheControl?: Anthropic.Beta.BetaCacheControlEphemeral;\n  /**\n   * Parameters for the user's location. Used to provide more relevant search\n   * results.\n   */\n  userLocation?: Anthropic.Beta.BetaWebSearchTool20250305.UserLocation;\n  /**\n   * If true, tool will not be included in initial system prompt. Only loaded when\n   * returned via tool_reference from tool search.\n   */\n  deferLoading?: boolean;\n  /**\n   * If true, tool will only return results from the allowed domains.\n   */\n  strict?: boolean;\n}\n\n/**\n * Creates a web search tool that gives Claude direct access to real-time web content,\n * allowing it to answer questions with up-to-date information beyond its knowledge cutoff.\n * Claude automatically cites sources from search results as part of its answer.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool | Anthropic 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 Anthropic API\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const model = new ChatAnthropic({\n *   model: \"claude-sonnet-4-5-20250929\",\n * });\n *\n * // Basic usage\n * const response = await model.invoke(\"What is the weather in NYC?\", {\n *   tools: [tools.webSearch_20250305()],\n * });\n *\n * // With options\n * const responseWithOptions = await model.invoke(\"Latest news about AI?\", {\n *   tools: [tools.webSearch_20250305({\n *     maxUses: 5,\n *     allowedDomains: [\"reuters.com\", \"bbc.com\"],\n *     userLocation: {\n *       type: \"approximate\",\n *       city: \"San Francisco\",\n *       region: \"California\",\n *       country: \"US\",\n *       timezone: \"America/Los_Angeles\",\n *     },\n *   })],\n * });\n * ```\n */\nexport function webSearch_20250305(\n  options?: WebSearch20250305Options\n): ServerTool {\n  return {\n    type: \"web_search_20250305\",\n    name: \"web_search\",\n    max_uses: options?.maxUses,\n    allowed_domains: options?.allowedDomains,\n    blocked_domains: options?.blockedDomains,\n    cache_control: options?.cacheControl,\n    defer_loading: options?.deferLoading,\n    strict: options?.strict,\n    user_location: options?.userLocation,\n  } satisfies Anthropic.Beta.BetaWebSearchTool20250305;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,SAAgB,mBACd,SACY;AACZ,QAAO;EACL,MAAM;EACN,MAAM;EACN,UAAU,SAAS;EACnB,iBAAiB,SAAS;EAC1B,iBAAiB,SAAS;EAC1B,eAAe,SAAS;EACxB,eAAe,SAAS;EACxB,QAAQ,SAAS;EACjB,eAAe,SAAS;EACzB"}