@ai-sdk/anthropic 3.0.0-beta.73 → 3.0.0-beta.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/index.d.mts +57 -1
- package/dist/index.d.ts +57 -1
- package/dist/index.js +423 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +407 -106
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +63 -0
- package/dist/internal/index.d.ts +63 -0
- package/dist/internal/index.js +416 -123
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +406 -105
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(internal_exports);
|
|
|
28
28
|
|
|
29
29
|
// src/anthropic-messages-language-model.ts
|
|
30
30
|
var import_provider3 = require("@ai-sdk/provider");
|
|
31
|
-
var
|
|
31
|
+
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/anthropic-error.ts
|
|
34
34
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
@@ -246,6 +246,26 @@ var anthropicMessagesResponseSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
246
246
|
old_start: import_v42.z.number().nullable()
|
|
247
247
|
})
|
|
248
248
|
])
|
|
249
|
+
}),
|
|
250
|
+
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
251
|
+
import_v42.z.object({
|
|
252
|
+
type: import_v42.z.literal("tool_search_tool_result"),
|
|
253
|
+
tool_use_id: import_v42.z.string(),
|
|
254
|
+
content: import_v42.z.union([
|
|
255
|
+
import_v42.z.object({
|
|
256
|
+
type: import_v42.z.literal("tool_search_tool_search_result"),
|
|
257
|
+
tool_references: import_v42.z.array(
|
|
258
|
+
import_v42.z.object({
|
|
259
|
+
type: import_v42.z.literal("tool_reference"),
|
|
260
|
+
tool_name: import_v42.z.string()
|
|
261
|
+
})
|
|
262
|
+
)
|
|
263
|
+
}),
|
|
264
|
+
import_v42.z.object({
|
|
265
|
+
type: import_v42.z.literal("tool_search_tool_result_error"),
|
|
266
|
+
error_code: import_v42.z.string()
|
|
267
|
+
})
|
|
268
|
+
])
|
|
249
269
|
})
|
|
250
270
|
])
|
|
251
271
|
),
|
|
@@ -447,6 +467,26 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
447
467
|
old_start: import_v42.z.number().nullable()
|
|
448
468
|
})
|
|
449
469
|
])
|
|
470
|
+
}),
|
|
471
|
+
// tool search tool results for tool_search_tool_regex_20251119 and tool_search_tool_bm25_20251119:
|
|
472
|
+
import_v42.z.object({
|
|
473
|
+
type: import_v42.z.literal("tool_search_tool_result"),
|
|
474
|
+
tool_use_id: import_v42.z.string(),
|
|
475
|
+
content: import_v42.z.union([
|
|
476
|
+
import_v42.z.object({
|
|
477
|
+
type: import_v42.z.literal("tool_search_tool_search_result"),
|
|
478
|
+
tool_references: import_v42.z.array(
|
|
479
|
+
import_v42.z.object({
|
|
480
|
+
type: import_v42.z.literal("tool_reference"),
|
|
481
|
+
tool_name: import_v42.z.string()
|
|
482
|
+
})
|
|
483
|
+
)
|
|
484
|
+
}),
|
|
485
|
+
import_v42.z.object({
|
|
486
|
+
type: import_v42.z.literal("tool_search_tool_result_error"),
|
|
487
|
+
error_code: import_v42.z.string()
|
|
488
|
+
})
|
|
489
|
+
])
|
|
450
490
|
})
|
|
451
491
|
])
|
|
452
492
|
}),
|
|
@@ -852,6 +892,7 @@ async function prepareTools({
|
|
|
852
892
|
cacheControlValidator,
|
|
853
893
|
supportsStructuredOutput
|
|
854
894
|
}) {
|
|
895
|
+
var _a;
|
|
855
896
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
856
897
|
const toolWarnings = [];
|
|
857
898
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -867,13 +908,24 @@ async function prepareTools({
|
|
|
867
908
|
type: "tool definition",
|
|
868
909
|
canCache: true
|
|
869
910
|
});
|
|
911
|
+
const anthropicOptions = (_a = tool.providerOptions) == null ? void 0 : _a.anthropic;
|
|
912
|
+
const deferLoading = anthropicOptions == null ? void 0 : anthropicOptions.deferLoading;
|
|
870
913
|
anthropicTools2.push({
|
|
871
914
|
name: tool.name,
|
|
872
915
|
description: tool.description,
|
|
873
916
|
input_schema: tool.inputSchema,
|
|
874
917
|
cache_control: cacheControl,
|
|
875
|
-
...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {}
|
|
918
|
+
...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {},
|
|
919
|
+
...deferLoading != null ? { defer_loading: deferLoading } : {},
|
|
920
|
+
...tool.inputExamples != null ? {
|
|
921
|
+
input_examples: tool.inputExamples.map(
|
|
922
|
+
(example) => example.input
|
|
923
|
+
)
|
|
924
|
+
} : {}
|
|
876
925
|
});
|
|
926
|
+
if (tool.inputExamples != null) {
|
|
927
|
+
betas.add("advanced-tool-use-2025-11-20");
|
|
928
|
+
}
|
|
877
929
|
break;
|
|
878
930
|
}
|
|
879
931
|
case "provider": {
|
|
@@ -1019,6 +1071,22 @@ async function prepareTools({
|
|
|
1019
1071
|
});
|
|
1020
1072
|
break;
|
|
1021
1073
|
}
|
|
1074
|
+
case "anthropic.tool_search_regex_20251119": {
|
|
1075
|
+
betas.add("advanced-tool-use-2025-11-20");
|
|
1076
|
+
anthropicTools2.push({
|
|
1077
|
+
type: "tool_search_tool_regex_20251119",
|
|
1078
|
+
name: "tool_search_tool_regex"
|
|
1079
|
+
});
|
|
1080
|
+
break;
|
|
1081
|
+
}
|
|
1082
|
+
case "anthropic.tool_search_bm25_20251119": {
|
|
1083
|
+
betas.add("advanced-tool-use-2025-11-20");
|
|
1084
|
+
anthropicTools2.push({
|
|
1085
|
+
type: "tool_search_tool_bm25_20251119",
|
|
1086
|
+
name: "tool_search_tool_bm25"
|
|
1087
|
+
});
|
|
1088
|
+
break;
|
|
1089
|
+
}
|
|
1022
1090
|
default: {
|
|
1023
1091
|
toolWarnings.push({
|
|
1024
1092
|
type: "unsupported",
|
|
@@ -1092,7 +1160,7 @@ async function prepareTools({
|
|
|
1092
1160
|
|
|
1093
1161
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1094
1162
|
var import_provider2 = require("@ai-sdk/provider");
|
|
1095
|
-
var
|
|
1163
|
+
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
1096
1164
|
|
|
1097
1165
|
// src/tool/code-execution_20250522.ts
|
|
1098
1166
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
@@ -1211,6 +1279,49 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
1211
1279
|
return factory5(args);
|
|
1212
1280
|
};
|
|
1213
1281
|
|
|
1282
|
+
// src/tool/tool-search-regex_20251119.ts
|
|
1283
|
+
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
1284
|
+
var import_v49 = require("zod/v4");
|
|
1285
|
+
var toolSearchRegex_20251119OutputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1286
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1287
|
+
import_v49.z.array(
|
|
1288
|
+
import_v49.z.object({
|
|
1289
|
+
type: import_v49.z.literal("tool_reference"),
|
|
1290
|
+
toolName: import_v49.z.string()
|
|
1291
|
+
})
|
|
1292
|
+
)
|
|
1293
|
+
)
|
|
1294
|
+
);
|
|
1295
|
+
var toolSearchRegex_20251119InputSchema = (0, import_provider_utils10.lazySchema)(
|
|
1296
|
+
() => (0, import_provider_utils10.zodSchema)(
|
|
1297
|
+
import_v49.z.object({
|
|
1298
|
+
/**
|
|
1299
|
+
* A regex pattern to search for tools.
|
|
1300
|
+
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
1301
|
+
*
|
|
1302
|
+
* Examples:
|
|
1303
|
+
* - "weather" - matches tool names/descriptions containing "weather"
|
|
1304
|
+
* - "get_.*_data" - matches tools like get_user_data, get_weather_data
|
|
1305
|
+
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
1306
|
+
* - "(?i)slack" - case-insensitive search
|
|
1307
|
+
*/
|
|
1308
|
+
pattern: import_v49.z.string(),
|
|
1309
|
+
/**
|
|
1310
|
+
* Maximum number of tools to return. Optional.
|
|
1311
|
+
*/
|
|
1312
|
+
limit: import_v49.z.number().optional()
|
|
1313
|
+
})
|
|
1314
|
+
)
|
|
1315
|
+
);
|
|
1316
|
+
var factory6 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
|
|
1317
|
+
id: "anthropic.tool_search_regex_20251119",
|
|
1318
|
+
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
1319
|
+
outputSchema: toolSearchRegex_20251119OutputSchema
|
|
1320
|
+
});
|
|
1321
|
+
var toolSearchRegex_20251119 = (args = {}) => {
|
|
1322
|
+
return factory6(args);
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1214
1325
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
1215
1326
|
function convertToString(data) {
|
|
1216
1327
|
if (typeof data === "string") {
|
|
@@ -1243,7 +1354,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1243
1354
|
const messages = [];
|
|
1244
1355
|
async function shouldEnableCitations(providerMetadata) {
|
|
1245
1356
|
var _a2, _b2;
|
|
1246
|
-
const anthropicOptions = await (0,
|
|
1357
|
+
const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
|
|
1247
1358
|
provider: "anthropic",
|
|
1248
1359
|
providerOptions: providerMetadata,
|
|
1249
1360
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1251,7 +1362,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1251
1362
|
return (_b2 = (_a2 = anthropicOptions == null ? void 0 : anthropicOptions.citations) == null ? void 0 : _a2.enabled) != null ? _b2 : false;
|
|
1252
1363
|
}
|
|
1253
1364
|
async function getDocumentMetadata(providerMetadata) {
|
|
1254
|
-
const anthropicOptions = await (0,
|
|
1365
|
+
const anthropicOptions = await (0, import_provider_utils11.parseProviderOptions)({
|
|
1255
1366
|
provider: "anthropic",
|
|
1256
1367
|
providerOptions: providerMetadata,
|
|
1257
1368
|
schema: anthropicFilePartProviderOptions
|
|
@@ -1317,7 +1428,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1317
1428
|
} : {
|
|
1318
1429
|
type: "base64",
|
|
1319
1430
|
media_type: part.mediaType === "image/*" ? "image/jpeg" : part.mediaType,
|
|
1320
|
-
data: (0,
|
|
1431
|
+
data: (0, import_provider_utils11.convertToBase64)(part.data)
|
|
1321
1432
|
},
|
|
1322
1433
|
cache_control: cacheControl
|
|
1323
1434
|
});
|
|
@@ -1337,7 +1448,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1337
1448
|
} : {
|
|
1338
1449
|
type: "base64",
|
|
1339
1450
|
media_type: "application/pdf",
|
|
1340
|
-
data: (0,
|
|
1451
|
+
data: (0, import_provider_utils11.convertToBase64)(part.data)
|
|
1341
1452
|
},
|
|
1342
1453
|
title: (_b = metadata.title) != null ? _b : part.filename,
|
|
1343
1454
|
...metadata.context && { context: metadata.context },
|
|
@@ -1457,7 +1568,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1457
1568
|
return void 0;
|
|
1458
1569
|
}
|
|
1459
1570
|
}
|
|
1460
|
-
}).filter(
|
|
1571
|
+
}).filter(import_provider_utils11.isNonNullable);
|
|
1461
1572
|
break;
|
|
1462
1573
|
case "text":
|
|
1463
1574
|
case "error-text":
|
|
@@ -1524,7 +1635,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1524
1635
|
}
|
|
1525
1636
|
case "reasoning": {
|
|
1526
1637
|
if (sendReasoning) {
|
|
1527
|
-
const reasoningMetadata = await (0,
|
|
1638
|
+
const reasoningMetadata = await (0, import_provider_utils11.parseProviderOptions)({
|
|
1528
1639
|
provider: "anthropic",
|
|
1529
1640
|
providerOptions: part.providerOptions,
|
|
1530
1641
|
schema: anthropicReasoningMetadataSchema
|
|
@@ -1615,6 +1726,14 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1615
1726
|
input: part.input,
|
|
1616
1727
|
cache_control: cacheControl
|
|
1617
1728
|
});
|
|
1729
|
+
} else if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
|
|
1730
|
+
anthropicContent.push({
|
|
1731
|
+
type: "server_tool_use",
|
|
1732
|
+
id: part.toolCallId,
|
|
1733
|
+
name: providerToolName,
|
|
1734
|
+
input: part.input,
|
|
1735
|
+
cache_control: cacheControl
|
|
1736
|
+
});
|
|
1618
1737
|
} else {
|
|
1619
1738
|
warnings.push({
|
|
1620
1739
|
type: "other",
|
|
@@ -1670,7 +1789,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1670
1789
|
break;
|
|
1671
1790
|
}
|
|
1672
1791
|
if (output.value.type === "code_execution_result") {
|
|
1673
|
-
const codeExecutionOutput = await (0,
|
|
1792
|
+
const codeExecutionOutput = await (0, import_provider_utils11.validateTypes)({
|
|
1674
1793
|
value: output.value,
|
|
1675
1794
|
schema: codeExecution_20250522OutputSchema
|
|
1676
1795
|
});
|
|
@@ -1686,7 +1805,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1686
1805
|
cache_control: cacheControl
|
|
1687
1806
|
});
|
|
1688
1807
|
} else {
|
|
1689
|
-
const codeExecutionOutput = await (0,
|
|
1808
|
+
const codeExecutionOutput = await (0, import_provider_utils11.validateTypes)({
|
|
1690
1809
|
value: output.value,
|
|
1691
1810
|
schema: codeExecution_20250825OutputSchema
|
|
1692
1811
|
});
|
|
@@ -1715,7 +1834,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1715
1834
|
});
|
|
1716
1835
|
break;
|
|
1717
1836
|
}
|
|
1718
|
-
const webFetchOutput = await (0,
|
|
1837
|
+
const webFetchOutput = await (0, import_provider_utils11.validateTypes)({
|
|
1719
1838
|
value: output.value,
|
|
1720
1839
|
schema: webFetch_20250910OutputSchema
|
|
1721
1840
|
});
|
|
@@ -1750,7 +1869,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1750
1869
|
});
|
|
1751
1870
|
break;
|
|
1752
1871
|
}
|
|
1753
|
-
const webSearchOutput = await (0,
|
|
1872
|
+
const webSearchOutput = await (0, import_provider_utils11.validateTypes)({
|
|
1754
1873
|
value: output.value,
|
|
1755
1874
|
schema: webSearch_20250305OutputSchema
|
|
1756
1875
|
});
|
|
@@ -1768,6 +1887,34 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1768
1887
|
});
|
|
1769
1888
|
break;
|
|
1770
1889
|
}
|
|
1890
|
+
if (providerToolName === "tool_search_tool_regex" || providerToolName === "tool_search_tool_bm25") {
|
|
1891
|
+
const output = part.output;
|
|
1892
|
+
if (output.type !== "json") {
|
|
1893
|
+
warnings.push({
|
|
1894
|
+
type: "other",
|
|
1895
|
+
message: `provider executed tool result output type ${output.type} for tool ${part.toolName} is not supported`
|
|
1896
|
+
});
|
|
1897
|
+
break;
|
|
1898
|
+
}
|
|
1899
|
+
const toolSearchOutput = await (0, import_provider_utils11.validateTypes)({
|
|
1900
|
+
value: output.value,
|
|
1901
|
+
schema: toolSearchRegex_20251119OutputSchema
|
|
1902
|
+
});
|
|
1903
|
+
const toolReferences = toolSearchOutput.map((ref) => ({
|
|
1904
|
+
type: "tool_reference",
|
|
1905
|
+
tool_name: ref.toolName
|
|
1906
|
+
}));
|
|
1907
|
+
anthropicContent.push({
|
|
1908
|
+
type: "tool_search_tool_result",
|
|
1909
|
+
tool_use_id: part.toolCallId,
|
|
1910
|
+
content: {
|
|
1911
|
+
type: "tool_search_tool_search_result",
|
|
1912
|
+
tool_references: toolReferences
|
|
1913
|
+
},
|
|
1914
|
+
cache_control: cacheControl
|
|
1915
|
+
});
|
|
1916
|
+
break;
|
|
1917
|
+
}
|
|
1771
1918
|
warnings.push({
|
|
1772
1919
|
type: "other",
|
|
1773
1920
|
message: `provider executed tool result for tool ${part.toolName} is not supported`
|
|
@@ -1895,7 +2042,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1895
2042
|
var _a;
|
|
1896
2043
|
this.modelId = modelId;
|
|
1897
2044
|
this.config = config;
|
|
1898
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
2045
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils12.generateId;
|
|
1899
2046
|
}
|
|
1900
2047
|
supportsUrl(url) {
|
|
1901
2048
|
return url.protocol === "https:";
|
|
@@ -1959,7 +2106,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1959
2106
|
});
|
|
1960
2107
|
}
|
|
1961
2108
|
}
|
|
1962
|
-
const anthropicOptions = await (0,
|
|
2109
|
+
const anthropicOptions = await (0, import_provider_utils12.parseProviderOptions)({
|
|
1963
2110
|
provider: "anthropic",
|
|
1964
2111
|
providerOptions,
|
|
1965
2112
|
schema: anthropicProviderOptions
|
|
@@ -1978,7 +2125,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1978
2125
|
inputSchema: responseFormat.schema
|
|
1979
2126
|
} : void 0;
|
|
1980
2127
|
const cacheControlValidator = new CacheControlValidator();
|
|
1981
|
-
const toolNameMapping = (0,
|
|
2128
|
+
const toolNameMapping = (0, import_provider_utils12.createToolNameMapping)({
|
|
1982
2129
|
tools,
|
|
1983
2130
|
providerToolNames: {
|
|
1984
2131
|
"anthropic.code_execution_20250522": "code_execution",
|
|
@@ -1993,7 +2140,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1993
2140
|
"anthropic.bash_20250124": "bash",
|
|
1994
2141
|
"anthropic.memory_20250818": "memory",
|
|
1995
2142
|
"anthropic.web_search_20250305": "web_search",
|
|
1996
|
-
"anthropic.web_fetch_20250910": "web_fetch"
|
|
2143
|
+
"anthropic.web_fetch_20250910": "web_fetch",
|
|
2144
|
+
"anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
|
|
2145
|
+
"anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25"
|
|
1997
2146
|
}
|
|
1998
2147
|
});
|
|
1999
2148
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
@@ -2163,15 +2312,15 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2163
2312
|
betas,
|
|
2164
2313
|
headers
|
|
2165
2314
|
}) {
|
|
2166
|
-
return (0,
|
|
2167
|
-
await (0,
|
|
2315
|
+
return (0, import_provider_utils12.combineHeaders)(
|
|
2316
|
+
await (0, import_provider_utils12.resolve)(this.config.headers),
|
|
2168
2317
|
headers,
|
|
2169
2318
|
betas.size > 0 ? { "anthropic-beta": Array.from(betas).join(",") } : {}
|
|
2170
2319
|
);
|
|
2171
2320
|
}
|
|
2172
2321
|
async getBetasFromHeaders(requestHeaders) {
|
|
2173
2322
|
var _a, _b;
|
|
2174
|
-
const configHeaders = await (0,
|
|
2323
|
+
const configHeaders = await (0, import_provider_utils12.resolve)(this.config.headers);
|
|
2175
2324
|
const configBetaHeader = (_a = configHeaders["anthropic-beta"]) != null ? _a : "";
|
|
2176
2325
|
const requestBetaHeader = (_b = requestHeaders == null ? void 0 : requestHeaders["anthropic-beta"]) != null ? _b : "";
|
|
2177
2326
|
return new Set(
|
|
@@ -2224,12 +2373,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2224
2373
|
responseHeaders,
|
|
2225
2374
|
value: response,
|
|
2226
2375
|
rawValue: rawResponse
|
|
2227
|
-
} = await (0,
|
|
2376
|
+
} = await (0, import_provider_utils12.postJsonToApi)({
|
|
2228
2377
|
url: this.buildRequestUrl(false),
|
|
2229
2378
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
2230
2379
|
body: this.transformRequestBody(args),
|
|
2231
2380
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
2232
|
-
successfulResponseHandler: (0,
|
|
2381
|
+
successfulResponseHandler: (0, import_provider_utils12.createJsonResponseHandler)(
|
|
2233
2382
|
anthropicMessagesResponseSchema
|
|
2234
2383
|
),
|
|
2235
2384
|
abortSignal: options.abortSignal,
|
|
@@ -2317,6 +2466,14 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2317
2466
|
input: JSON.stringify(part.input),
|
|
2318
2467
|
providerExecuted: true
|
|
2319
2468
|
});
|
|
2469
|
+
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
2470
|
+
content.push({
|
|
2471
|
+
type: "tool-call",
|
|
2472
|
+
toolCallId: part.id,
|
|
2473
|
+
toolName: toolNameMapping.toCustomToolName(part.name),
|
|
2474
|
+
input: JSON.stringify(part.input),
|
|
2475
|
+
providerExecuted: true
|
|
2476
|
+
});
|
|
2320
2477
|
}
|
|
2321
2478
|
break;
|
|
2322
2479
|
}
|
|
@@ -2470,6 +2627,32 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2470
2627
|
});
|
|
2471
2628
|
break;
|
|
2472
2629
|
}
|
|
2630
|
+
// tool search tool results:
|
|
2631
|
+
case "tool_search_tool_result": {
|
|
2632
|
+
if (part.content.type === "tool_search_tool_search_result") {
|
|
2633
|
+
content.push({
|
|
2634
|
+
type: "tool-result",
|
|
2635
|
+
toolCallId: part.tool_use_id,
|
|
2636
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
2637
|
+
result: part.content.tool_references.map((ref) => ({
|
|
2638
|
+
type: ref.type,
|
|
2639
|
+
toolName: ref.tool_name
|
|
2640
|
+
}))
|
|
2641
|
+
});
|
|
2642
|
+
} else {
|
|
2643
|
+
content.push({
|
|
2644
|
+
type: "tool-result",
|
|
2645
|
+
toolCallId: part.tool_use_id,
|
|
2646
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
2647
|
+
isError: true,
|
|
2648
|
+
result: {
|
|
2649
|
+
type: "tool_search_tool_result_error",
|
|
2650
|
+
errorCode: part.content.error_code
|
|
2651
|
+
}
|
|
2652
|
+
});
|
|
2653
|
+
}
|
|
2654
|
+
break;
|
|
2655
|
+
}
|
|
2473
2656
|
}
|
|
2474
2657
|
}
|
|
2475
2658
|
return {
|
|
@@ -2525,12 +2708,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2525
2708
|
});
|
|
2526
2709
|
const citationDocuments = this.extractCitationDocuments(options.prompt);
|
|
2527
2710
|
const url = this.buildRequestUrl(true);
|
|
2528
|
-
const { responseHeaders, value: response } = await (0,
|
|
2711
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils12.postJsonToApi)({
|
|
2529
2712
|
url,
|
|
2530
2713
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
2531
2714
|
body: this.transformRequestBody(body),
|
|
2532
2715
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
2533
|
-
successfulResponseHandler: (0,
|
|
2716
|
+
successfulResponseHandler: (0, import_provider_utils12.createEventSourceResponseHandler)(
|
|
2534
2717
|
anthropicMessagesChunkSchema
|
|
2535
2718
|
),
|
|
2536
2719
|
abortSignal: options.abortSignal,
|
|
@@ -2660,6 +2843,25 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2660
2843
|
toolName: customToolName,
|
|
2661
2844
|
providerExecuted: true
|
|
2662
2845
|
});
|
|
2846
|
+
} else if (part.name === "tool_search_tool_regex" || part.name === "tool_search_tool_bm25") {
|
|
2847
|
+
const customToolName = toolNameMapping.toCustomToolName(
|
|
2848
|
+
part.name
|
|
2849
|
+
);
|
|
2850
|
+
contentBlocks[value.index] = {
|
|
2851
|
+
type: "tool-call",
|
|
2852
|
+
toolCallId: part.id,
|
|
2853
|
+
toolName: customToolName,
|
|
2854
|
+
input: "",
|
|
2855
|
+
providerExecuted: true,
|
|
2856
|
+
firstDelta: true,
|
|
2857
|
+
providerToolName: part.name
|
|
2858
|
+
};
|
|
2859
|
+
controller.enqueue({
|
|
2860
|
+
type: "tool-input-start",
|
|
2861
|
+
id: part.id,
|
|
2862
|
+
toolName: customToolName,
|
|
2863
|
+
providerExecuted: true
|
|
2864
|
+
});
|
|
2663
2865
|
}
|
|
2664
2866
|
return;
|
|
2665
2867
|
}
|
|
@@ -2783,6 +2985,32 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2783
2985
|
});
|
|
2784
2986
|
return;
|
|
2785
2987
|
}
|
|
2988
|
+
// tool search tool results:
|
|
2989
|
+
case "tool_search_tool_result": {
|
|
2990
|
+
if (part.content.type === "tool_search_tool_search_result") {
|
|
2991
|
+
controller.enqueue({
|
|
2992
|
+
type: "tool-result",
|
|
2993
|
+
toolCallId: part.tool_use_id,
|
|
2994
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
2995
|
+
result: part.content.tool_references.map((ref) => ({
|
|
2996
|
+
type: ref.type,
|
|
2997
|
+
toolName: ref.tool_name
|
|
2998
|
+
}))
|
|
2999
|
+
});
|
|
3000
|
+
} else {
|
|
3001
|
+
controller.enqueue({
|
|
3002
|
+
type: "tool-result",
|
|
3003
|
+
toolCallId: part.tool_use_id,
|
|
3004
|
+
toolName: toolNameMapping.toCustomToolName("tool_search"),
|
|
3005
|
+
isError: true,
|
|
3006
|
+
result: {
|
|
3007
|
+
type: "tool_search_tool_result_error",
|
|
3008
|
+
errorCode: part.content.error_code
|
|
3009
|
+
}
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
return;
|
|
3013
|
+
}
|
|
2786
3014
|
case "mcp_tool_use": {
|
|
2787
3015
|
mcpToolCalls[part.id] = {
|
|
2788
3016
|
type: "tool-call",
|
|
@@ -3094,44 +3322,44 @@ function getModelCapabilities(modelId) {
|
|
|
3094
3322
|
}
|
|
3095
3323
|
|
|
3096
3324
|
// src/tool/bash_20241022.ts
|
|
3097
|
-
var
|
|
3098
|
-
var
|
|
3099
|
-
var bash_20241022InputSchema = (0,
|
|
3100
|
-
() => (0,
|
|
3101
|
-
|
|
3102
|
-
command:
|
|
3103
|
-
restart:
|
|
3325
|
+
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
3326
|
+
var import_v410 = require("zod/v4");
|
|
3327
|
+
var bash_20241022InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
3328
|
+
() => (0, import_provider_utils13.zodSchema)(
|
|
3329
|
+
import_v410.z.object({
|
|
3330
|
+
command: import_v410.z.string(),
|
|
3331
|
+
restart: import_v410.z.boolean().optional()
|
|
3104
3332
|
})
|
|
3105
3333
|
)
|
|
3106
3334
|
);
|
|
3107
|
-
var bash_20241022 = (0,
|
|
3335
|
+
var bash_20241022 = (0, import_provider_utils13.createProviderToolFactory)({
|
|
3108
3336
|
id: "anthropic.bash_20241022",
|
|
3109
3337
|
inputSchema: bash_20241022InputSchema
|
|
3110
3338
|
});
|
|
3111
3339
|
|
|
3112
3340
|
// src/tool/bash_20250124.ts
|
|
3113
|
-
var
|
|
3114
|
-
var
|
|
3115
|
-
var bash_20250124InputSchema = (0,
|
|
3116
|
-
() => (0,
|
|
3117
|
-
|
|
3118
|
-
command:
|
|
3119
|
-
restart:
|
|
3341
|
+
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
3342
|
+
var import_v411 = require("zod/v4");
|
|
3343
|
+
var bash_20250124InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
3344
|
+
() => (0, import_provider_utils14.zodSchema)(
|
|
3345
|
+
import_v411.z.object({
|
|
3346
|
+
command: import_v411.z.string(),
|
|
3347
|
+
restart: import_v411.z.boolean().optional()
|
|
3120
3348
|
})
|
|
3121
3349
|
)
|
|
3122
3350
|
);
|
|
3123
|
-
var bash_20250124 = (0,
|
|
3351
|
+
var bash_20250124 = (0, import_provider_utils14.createProviderToolFactory)({
|
|
3124
3352
|
id: "anthropic.bash_20250124",
|
|
3125
3353
|
inputSchema: bash_20250124InputSchema
|
|
3126
3354
|
});
|
|
3127
3355
|
|
|
3128
3356
|
// src/tool/computer_20241022.ts
|
|
3129
|
-
var
|
|
3130
|
-
var
|
|
3131
|
-
var computer_20241022InputSchema = (0,
|
|
3132
|
-
() => (0,
|
|
3133
|
-
|
|
3134
|
-
action:
|
|
3357
|
+
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
3358
|
+
var import_v412 = require("zod/v4");
|
|
3359
|
+
var computer_20241022InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
3360
|
+
() => (0, import_provider_utils15.zodSchema)(
|
|
3361
|
+
import_v412.z.object({
|
|
3362
|
+
action: import_v412.z.enum([
|
|
3135
3363
|
"key",
|
|
3136
3364
|
"type",
|
|
3137
3365
|
"mouse_move",
|
|
@@ -3143,23 +3371,23 @@ var computer_20241022InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
3143
3371
|
"screenshot",
|
|
3144
3372
|
"cursor_position"
|
|
3145
3373
|
]),
|
|
3146
|
-
coordinate:
|
|
3147
|
-
text:
|
|
3374
|
+
coordinate: import_v412.z.array(import_v412.z.number().int()).optional(),
|
|
3375
|
+
text: import_v412.z.string().optional()
|
|
3148
3376
|
})
|
|
3149
3377
|
)
|
|
3150
3378
|
);
|
|
3151
|
-
var computer_20241022 = (0,
|
|
3379
|
+
var computer_20241022 = (0, import_provider_utils15.createProviderToolFactory)({
|
|
3152
3380
|
id: "anthropic.computer_20241022",
|
|
3153
3381
|
inputSchema: computer_20241022InputSchema
|
|
3154
3382
|
});
|
|
3155
3383
|
|
|
3156
3384
|
// src/tool/computer_20250124.ts
|
|
3157
|
-
var
|
|
3158
|
-
var
|
|
3159
|
-
var computer_20250124InputSchema = (0,
|
|
3160
|
-
() => (0,
|
|
3161
|
-
|
|
3162
|
-
action:
|
|
3385
|
+
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
3386
|
+
var import_v413 = require("zod/v4");
|
|
3387
|
+
var computer_20250124InputSchema = (0, import_provider_utils16.lazySchema)(
|
|
3388
|
+
() => (0, import_provider_utils16.zodSchema)(
|
|
3389
|
+
import_v413.z.object({
|
|
3390
|
+
action: import_v413.z.enum([
|
|
3163
3391
|
"key",
|
|
3164
3392
|
"hold_key",
|
|
3165
3393
|
"type",
|
|
@@ -3177,90 +3405,69 @@ var computer_20250124InputSchema = (0, import_provider_utils15.lazySchema)(
|
|
|
3177
3405
|
"wait",
|
|
3178
3406
|
"screenshot"
|
|
3179
3407
|
]),
|
|
3180
|
-
coordinate:
|
|
3181
|
-
duration:
|
|
3182
|
-
scroll_amount:
|
|
3183
|
-
scroll_direction:
|
|
3184
|
-
start_coordinate:
|
|
3185
|
-
text:
|
|
3408
|
+
coordinate: import_v413.z.tuple([import_v413.z.number().int(), import_v413.z.number().int()]).optional(),
|
|
3409
|
+
duration: import_v413.z.number().optional(),
|
|
3410
|
+
scroll_amount: import_v413.z.number().optional(),
|
|
3411
|
+
scroll_direction: import_v413.z.enum(["up", "down", "left", "right"]).optional(),
|
|
3412
|
+
start_coordinate: import_v413.z.tuple([import_v413.z.number().int(), import_v413.z.number().int()]).optional(),
|
|
3413
|
+
text: import_v413.z.string().optional()
|
|
3186
3414
|
})
|
|
3187
3415
|
)
|
|
3188
3416
|
);
|
|
3189
|
-
var computer_20250124 = (0,
|
|
3417
|
+
var computer_20250124 = (0, import_provider_utils16.createProviderToolFactory)({
|
|
3190
3418
|
id: "anthropic.computer_20250124",
|
|
3191
3419
|
inputSchema: computer_20250124InputSchema
|
|
3192
3420
|
});
|
|
3193
3421
|
|
|
3194
3422
|
// src/tool/memory_20250818.ts
|
|
3195
|
-
var
|
|
3196
|
-
var
|
|
3197
|
-
var memory_20250818InputSchema = (0,
|
|
3198
|
-
() => (0,
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
command:
|
|
3202
|
-
path:
|
|
3203
|
-
view_range:
|
|
3423
|
+
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
3424
|
+
var import_v414 = require("zod/v4");
|
|
3425
|
+
var memory_20250818InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
3426
|
+
() => (0, import_provider_utils17.zodSchema)(
|
|
3427
|
+
import_v414.z.discriminatedUnion("command", [
|
|
3428
|
+
import_v414.z.object({
|
|
3429
|
+
command: import_v414.z.literal("view"),
|
|
3430
|
+
path: import_v414.z.string(),
|
|
3431
|
+
view_range: import_v414.z.tuple([import_v414.z.number(), import_v414.z.number()]).optional()
|
|
3204
3432
|
}),
|
|
3205
|
-
|
|
3206
|
-
command:
|
|
3207
|
-
path:
|
|
3208
|
-
file_text:
|
|
3433
|
+
import_v414.z.object({
|
|
3434
|
+
command: import_v414.z.literal("create"),
|
|
3435
|
+
path: import_v414.z.string(),
|
|
3436
|
+
file_text: import_v414.z.string()
|
|
3209
3437
|
}),
|
|
3210
|
-
|
|
3211
|
-
command:
|
|
3212
|
-
path:
|
|
3213
|
-
old_str:
|
|
3214
|
-
new_str:
|
|
3438
|
+
import_v414.z.object({
|
|
3439
|
+
command: import_v414.z.literal("str_replace"),
|
|
3440
|
+
path: import_v414.z.string(),
|
|
3441
|
+
old_str: import_v414.z.string(),
|
|
3442
|
+
new_str: import_v414.z.string()
|
|
3215
3443
|
}),
|
|
3216
|
-
|
|
3217
|
-
command:
|
|
3218
|
-
path:
|
|
3219
|
-
insert_line:
|
|
3220
|
-
insert_text:
|
|
3444
|
+
import_v414.z.object({
|
|
3445
|
+
command: import_v414.z.literal("insert"),
|
|
3446
|
+
path: import_v414.z.string(),
|
|
3447
|
+
insert_line: import_v414.z.number(),
|
|
3448
|
+
insert_text: import_v414.z.string()
|
|
3221
3449
|
}),
|
|
3222
|
-
|
|
3223
|
-
command:
|
|
3224
|
-
path:
|
|
3450
|
+
import_v414.z.object({
|
|
3451
|
+
command: import_v414.z.literal("delete"),
|
|
3452
|
+
path: import_v414.z.string()
|
|
3225
3453
|
}),
|
|
3226
|
-
|
|
3227
|
-
command:
|
|
3228
|
-
old_path:
|
|
3229
|
-
new_path:
|
|
3454
|
+
import_v414.z.object({
|
|
3455
|
+
command: import_v414.z.literal("rename"),
|
|
3456
|
+
old_path: import_v414.z.string(),
|
|
3457
|
+
new_path: import_v414.z.string()
|
|
3230
3458
|
})
|
|
3231
3459
|
])
|
|
3232
3460
|
)
|
|
3233
3461
|
);
|
|
3234
|
-
var memory_20250818 = (0,
|
|
3462
|
+
var memory_20250818 = (0, import_provider_utils17.createProviderToolFactory)({
|
|
3235
3463
|
id: "anthropic.memory_20250818",
|
|
3236
3464
|
inputSchema: memory_20250818InputSchema
|
|
3237
3465
|
});
|
|
3238
3466
|
|
|
3239
3467
|
// src/tool/text-editor_20241022.ts
|
|
3240
|
-
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
3241
|
-
var import_v414 = require("zod/v4");
|
|
3242
|
-
var textEditor_20241022InputSchema = (0, import_provider_utils17.lazySchema)(
|
|
3243
|
-
() => (0, import_provider_utils17.zodSchema)(
|
|
3244
|
-
import_v414.z.object({
|
|
3245
|
-
command: import_v414.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
3246
|
-
path: import_v414.z.string(),
|
|
3247
|
-
file_text: import_v414.z.string().optional(),
|
|
3248
|
-
insert_line: import_v414.z.number().int().optional(),
|
|
3249
|
-
new_str: import_v414.z.string().optional(),
|
|
3250
|
-
old_str: import_v414.z.string().optional(),
|
|
3251
|
-
view_range: import_v414.z.array(import_v414.z.number().int()).optional()
|
|
3252
|
-
})
|
|
3253
|
-
)
|
|
3254
|
-
);
|
|
3255
|
-
var textEditor_20241022 = (0, import_provider_utils17.createProviderToolFactory)({
|
|
3256
|
-
id: "anthropic.text_editor_20241022",
|
|
3257
|
-
inputSchema: textEditor_20241022InputSchema
|
|
3258
|
-
});
|
|
3259
|
-
|
|
3260
|
-
// src/tool/text-editor_20250124.ts
|
|
3261
3468
|
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
3262
3469
|
var import_v415 = require("zod/v4");
|
|
3263
|
-
var
|
|
3470
|
+
var textEditor_20241022InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
3264
3471
|
() => (0, import_provider_utils18.zodSchema)(
|
|
3265
3472
|
import_v415.z.object({
|
|
3266
3473
|
command: import_v415.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
@@ -3273,18 +3480,18 @@ var textEditor_20250124InputSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
3273
3480
|
})
|
|
3274
3481
|
)
|
|
3275
3482
|
);
|
|
3276
|
-
var
|
|
3277
|
-
id: "anthropic.
|
|
3278
|
-
inputSchema:
|
|
3483
|
+
var textEditor_20241022 = (0, import_provider_utils18.createProviderToolFactory)({
|
|
3484
|
+
id: "anthropic.text_editor_20241022",
|
|
3485
|
+
inputSchema: textEditor_20241022InputSchema
|
|
3279
3486
|
});
|
|
3280
3487
|
|
|
3281
|
-
// src/tool/text-
|
|
3488
|
+
// src/tool/text-editor_20250124.ts
|
|
3282
3489
|
var import_provider_utils19 = require("@ai-sdk/provider-utils");
|
|
3283
3490
|
var import_v416 = require("zod/v4");
|
|
3284
|
-
var
|
|
3491
|
+
var textEditor_20250124InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
3285
3492
|
() => (0, import_provider_utils19.zodSchema)(
|
|
3286
3493
|
import_v416.z.object({
|
|
3287
|
-
command: import_v416.z.enum(["view", "create", "str_replace", "insert"]),
|
|
3494
|
+
command: import_v416.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
3288
3495
|
path: import_v416.z.string(),
|
|
3289
3496
|
file_text: import_v416.z.string().optional(),
|
|
3290
3497
|
insert_line: import_v416.z.number().int().optional(),
|
|
@@ -3294,11 +3501,69 @@ var textEditor_20250429InputSchema = (0, import_provider_utils19.lazySchema)(
|
|
|
3294
3501
|
})
|
|
3295
3502
|
)
|
|
3296
3503
|
);
|
|
3297
|
-
var
|
|
3504
|
+
var textEditor_20250124 = (0, import_provider_utils19.createProviderToolFactory)({
|
|
3505
|
+
id: "anthropic.text_editor_20250124",
|
|
3506
|
+
inputSchema: textEditor_20250124InputSchema
|
|
3507
|
+
});
|
|
3508
|
+
|
|
3509
|
+
// src/tool/text-editor_20250429.ts
|
|
3510
|
+
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
3511
|
+
var import_v417 = require("zod/v4");
|
|
3512
|
+
var textEditor_20250429InputSchema = (0, import_provider_utils20.lazySchema)(
|
|
3513
|
+
() => (0, import_provider_utils20.zodSchema)(
|
|
3514
|
+
import_v417.z.object({
|
|
3515
|
+
command: import_v417.z.enum(["view", "create", "str_replace", "insert"]),
|
|
3516
|
+
path: import_v417.z.string(),
|
|
3517
|
+
file_text: import_v417.z.string().optional(),
|
|
3518
|
+
insert_line: import_v417.z.number().int().optional(),
|
|
3519
|
+
new_str: import_v417.z.string().optional(),
|
|
3520
|
+
old_str: import_v417.z.string().optional(),
|
|
3521
|
+
view_range: import_v417.z.array(import_v417.z.number().int()).optional()
|
|
3522
|
+
})
|
|
3523
|
+
)
|
|
3524
|
+
);
|
|
3525
|
+
var textEditor_20250429 = (0, import_provider_utils20.createProviderToolFactory)({
|
|
3298
3526
|
id: "anthropic.text_editor_20250429",
|
|
3299
3527
|
inputSchema: textEditor_20250429InputSchema
|
|
3300
3528
|
});
|
|
3301
3529
|
|
|
3530
|
+
// src/tool/tool-search-bm25_20251119.ts
|
|
3531
|
+
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
3532
|
+
var import_v418 = require("zod/v4");
|
|
3533
|
+
var toolSearchBm25_20251119OutputSchema = (0, import_provider_utils21.lazySchema)(
|
|
3534
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
3535
|
+
import_v418.z.array(
|
|
3536
|
+
import_v418.z.object({
|
|
3537
|
+
type: import_v418.z.literal("tool_reference"),
|
|
3538
|
+
toolName: import_v418.z.string()
|
|
3539
|
+
})
|
|
3540
|
+
)
|
|
3541
|
+
)
|
|
3542
|
+
);
|
|
3543
|
+
var toolSearchBm25_20251119InputSchema = (0, import_provider_utils21.lazySchema)(
|
|
3544
|
+
() => (0, import_provider_utils21.zodSchema)(
|
|
3545
|
+
import_v418.z.object({
|
|
3546
|
+
/**
|
|
3547
|
+
* A natural language query to search for tools.
|
|
3548
|
+
* Claude will use BM25 text search to find relevant tools.
|
|
3549
|
+
*/
|
|
3550
|
+
query: import_v418.z.string(),
|
|
3551
|
+
/**
|
|
3552
|
+
* Maximum number of tools to return. Optional.
|
|
3553
|
+
*/
|
|
3554
|
+
limit: import_v418.z.number().optional()
|
|
3555
|
+
})
|
|
3556
|
+
)
|
|
3557
|
+
);
|
|
3558
|
+
var factory7 = (0, import_provider_utils21.createProviderToolFactoryWithOutputSchema)({
|
|
3559
|
+
id: "anthropic.tool_search_bm25_20251119",
|
|
3560
|
+
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
3561
|
+
outputSchema: toolSearchBm25_20251119OutputSchema
|
|
3562
|
+
});
|
|
3563
|
+
var toolSearchBm25_20251119 = (args = {}) => {
|
|
3564
|
+
return factory7(args);
|
|
3565
|
+
};
|
|
3566
|
+
|
|
3302
3567
|
// src/anthropic-tools.ts
|
|
3303
3568
|
var anthropicTools = {
|
|
3304
3569
|
/**
|
|
@@ -3422,7 +3687,35 @@ var anthropicTools = {
|
|
|
3422
3687
|
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
3423
3688
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
3424
3689
|
*/
|
|
3425
|
-
webSearch_20250305
|
|
3690
|
+
webSearch_20250305,
|
|
3691
|
+
/**
|
|
3692
|
+
* Creates a tool search tool that uses regex patterns to find tools.
|
|
3693
|
+
*
|
|
3694
|
+
* The tool search tool enables Claude to work with hundreds or thousands of tools
|
|
3695
|
+
* by dynamically discovering and loading them on-demand. Instead of loading all
|
|
3696
|
+
* tool definitions into the context window upfront, Claude searches your tool
|
|
3697
|
+
* catalog and loads only the tools it needs.
|
|
3698
|
+
*
|
|
3699
|
+
* Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
|
|
3700
|
+
* to mark them for deferred loading.
|
|
3701
|
+
*
|
|
3702
|
+
* Supported models: Claude Opus 4.5, Claude Sonnet 4.5
|
|
3703
|
+
*/
|
|
3704
|
+
toolSearchRegex_20251119,
|
|
3705
|
+
/**
|
|
3706
|
+
* Creates a tool search tool that uses BM25 (natural language) to find tools.
|
|
3707
|
+
*
|
|
3708
|
+
* The tool search tool enables Claude to work with hundreds or thousands of tools
|
|
3709
|
+
* by dynamically discovering and loading them on-demand. Instead of loading all
|
|
3710
|
+
* tool definitions into the context window upfront, Claude searches your tool
|
|
3711
|
+
* catalog and loads only the tools it needs.
|
|
3712
|
+
*
|
|
3713
|
+
* Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
|
|
3714
|
+
* to mark them for deferred loading.
|
|
3715
|
+
*
|
|
3716
|
+
* Supported models: Claude Opus 4.5, Claude Sonnet 4.5
|
|
3717
|
+
*/
|
|
3718
|
+
toolSearchBm25_20251119
|
|
3426
3719
|
};
|
|
3427
3720
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3428
3721
|
0 && (module.exports = {
|