@langchain/anthropic
Version:
Anthropic integrations for LangChain.js
1 lines • 4.25 kB
Source Map (JSON)
{"version":3,"file":"toolSearch.d.cts","names":["Anthropic","ServerTool","ToolSearchOptions","Beta","BetaCacheControlEphemeral","toolSearchRegex_20251119","toolSearchBM25_20251119"],"sources":["../../src/tools/toolSearch.d.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { type ServerTool } from \"@langchain/core/tools\";\n/**\n * Options for the tool search tool.\n */\nexport interface ToolSearchOptions {\n /**\n * Create a cache control breakpoint at this content block.\n */\n cacheControl?: Anthropic.Beta.BetaCacheControlEphemeral;\n}\n/**\n * Creates a regex-based tool search tool that enables Claude to work with hundreds\n * or thousands of tools by dynamically discovering and loading them on-demand.\n * Claude constructs regex patterns (using Python's `re.search()` syntax) to search\n * for tools by name, description, argument names, and argument descriptions.\n *\n * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}\n * @param options - Configuration options for the tool search tool\n * @returns A tool 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 * const getWeather = tool(\n * async (input: { location: string }) => {\n * return `Weather in ${input.location}`;\n * },\n * {\n * name: \"get_weather\",\n * description: \"Get the weather at a specific location\",\n * schema: z.object({\n * location: z.string(),\n * }),\n * extras: { defer_loading: true },\n * },\n * );\n *\n * // Use with deferred tools - Claude will search and discover tools as needed\n * const response = await model.invoke(\"What is the weather in San Francisco?\", {\n * tools: [\n * tools.toolSearchRegex_20251119(),\n * getWeather,\n * ],\n * });\n * ```\n */\nexport declare function toolSearchRegex_20251119(options?: ToolSearchOptions): ServerTool;\n/**\n * Creates a BM25-based tool search tool that enables Claude to work with hundreds\n * or thousands of tools by dynamically discovering and loading them on-demand.\n * Claude uses natural language queries to search for tools by name, description,\n * argument names, and argument descriptions.\n *\n * @note This tool requires the beta header `advanced-tool-use-2025-11-20` in API requests.\n *\n * @see {@link https://docs.anthropic.com/en/docs/build-with-claude/tool-use/tool-search-tool | Anthropic Tool Search Documentation}\n * @param options - Configuration options for the tool search tool\n * @returns A tool 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 * clientOptions: {\n * defaultHeaders: { \"anthropic-beta\": \"advanced-tool-use-2025-11-20\" },\n * },\n * });\n *\n * const getWeather = tool(\n * async (input: { location: string }) => {\n * return `Weather in ${input.location}`;\n * },\n * {\n * name: \"get_weather\",\n * description: \"Get the weather at a specific location\",\n * schema: z.object({\n * location: z.string(),\n * }),\n * extras: { defer_loading: true },\n * },\n * );\n *\n * // Use with deferred tools - Claude will search using natural language\n * const response = await model.invoke(\"What is the weather in San Francisco?\", {\n * tools: [\n * tools.toolSearchBM25_20251119(),\n * getWeather,\n * ],\n * });\n * ```\n */\nexport declare function toolSearchBM25_20251119(options?: ToolSearchOptions): ServerTool;\n//# sourceMappingURL=toolSearch.d.ts.map"],"mappings":";;;;;;;AAKA;AAiDwBK,UAjDPH,iBAAAA,CAiD+B;EA+CxBI;;;iBA5FLN,SAAAA,CAAUG,IAAAA,CAAKC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6CVC,wBAAAA,WAAmCH,oBAAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+CvDK,uBAAAA,WAAkCJ,oBAAoBD"}