@langchain/anthropic
Version:
Anthropic integrations for LangChain.js
1 lines • 3.77 kB
Source Map (JSON)
{"version":3,"file":"webFetch.d.cts","names":["Anthropic","ServerTool","WebFetch20250910Options","Beta","BetaCacheControlEphemeral","webFetch_20250910"],"sources":["../../src/tools/webFetch.d.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { type ServerTool } from \"@langchain/core/tools\";\n/**\n * Options for the web fetch tool.\n */\nexport interface WebFetch20250910Options {\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 fetched. Cannot be used\n * alongside `blockedDomains`.\n */\n allowedDomains?: string[];\n /**\n * If provided, these domains will never be fetched. Cannot be used\n * alongside `allowedDomains`.\n */\n blockedDomains?: string[];\n /**\n * Create a cache control breakpoint at this content block.\n */\n cacheControl?: Anthropic.Beta.BetaCacheControlEphemeral;\n /**\n * Enable citations for fetched content. Unlike web search where citations\n * are always enabled, citations are optional for web fetch.\n */\n citations?: {\n enabled: boolean;\n };\n /**\n * Maximum content length in tokens. If the fetched content exceeds this limit,\n * it will be truncated. This helps control token usage when fetching large documents.\n */\n maxContentTokens?: number;\n}\n/**\n * Creates a web fetch tool that allows Claude to retrieve full content from specified\n * web pages and PDF documents. Claude can only fetch URLs that have been explicitly\n * provided by the user or that come from previous web search or web fetch results.\n *\n * @warning Enabling the web fetch tool in environments where Claude processes untrusted\n * input alongside sensitive data poses data exfiltration risks. We recommend only using\n * this tool in trusted environments or when handling non-sensitive data.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-fetch-tool | Anthropic Web Fetch Documentation}\n * @param options - Configuration options for the web fetch tool\n * @returns A web fetch 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 - fetch content from a URL\n * const response = await model.invoke(\n * \"Please analyze the content at https://example.com/article\",\n * { tools: [tools.webFetch_20250910()] }\n * );\n *\n * // With options\n * const responseWithOptions = await model.invoke(\n * \"Summarize this research paper: https://arxiv.org/abs/2024.12345\",\n * {\n * tools: [tools.webFetch_20250910({\n * maxUses: 5,\n * allowedDomains: [\"arxiv.org\", \"example.com\"],\n * citations: { enabled: true },\n * maxContentTokens: 50000,\n * })],\n * }\n * );\n *\n * // Combined with web search for comprehensive information gathering\n * const combinedResponse = await model.invoke(\n * \"Find recent articles about quantum computing and analyze the most relevant one\",\n * {\n * tools: [\n * tools.webSearch_20250305({ maxUses: 3 }),\n * tools.webFetch_20250910({ maxUses: 5, citations: { enabled: true } }),\n * ],\n * }\n * );\n * ```\n */\nexport declare function webFetch_20250910(options?: WebFetch20250910Options): ServerTool;\n//# sourceMappingURL=webFetch.d.ts.map"],"mappings":";;;;;;;AAKA;AAoFwBK,UApFPH,uBAAAA,CAoFmCA;;;;;;;;;;;;;;;;;;iBAlEjCF,SAAAA,CAAUG,IAAAA,CAAKC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkEVC,iBAAAA,WAA4BH,0BAA0BD"}