@ai-sdk/anthropic 3.0.140 → 3.0.143
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 +26 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +99 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -39
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +98 -38
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +98 -38
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +70 -13
- package/package.json +2 -2
- package/src/anthropic-messages-language-model.ts +85 -29
- package/src/anthropic-messages-options.ts +12 -2
- package/src/tool/computer-toolset_20260801.ts +40 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 3.0.143
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [d59eee0]
|
|
8
|
+
- @ai-sdk/provider-utils@4.0.67
|
|
9
|
+
|
|
10
|
+
## 3.0.142
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 05c2ec6: Require the request-level `allowInlineToolDefinitions` opt-in for by-value system-message tool additions. This prevents client UI history from introducing undeclared provider tools or replacing server-configured tool restrictions with default or automatic tool choice. Enable the option only for server-controlled messages; declared tools and changes by reference remain supported.
|
|
15
|
+
- Updated dependencies [88bb257]
|
|
16
|
+
- @ai-sdk/provider-utils@4.0.66
|
|
17
|
+
|
|
18
|
+
## 3.0.141
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 69e9ea1: feat(anthropic): add Claude Fable 5.2 support
|
|
23
|
+
|
|
24
|
+
- add the `claude-fable-5-2` model ID to `@ai-sdk/anthropic` and `@ai-sdk/google-vertex`, `anthropic.claude-fable-5-2` and `us.anthropic.claude-fable-5-2` to `@ai-sdk/amazon-bedrock`, and `anthropic/claude-fable-5.2` to `@ai-sdk/gateway`
|
|
25
|
+
- recognize `claude-fable-5-2` as a known model with the same capabilities as `claude-fable-5-1`: 128k max output tokens, always-on adaptive thinking, all five effort levels, no sampling parameters, and no forced tool use
|
|
26
|
+
|
|
27
|
+
- e319171: Keep computer toolset actions tied to the returned member name and reject disabled or unavailable members before emitting tool calls. Apply member configuration to local input validation and reject malformed or non-object member input.
|
|
28
|
+
|
|
3
29
|
## 3.0.140
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -220,7 +220,7 @@ interface AnthropicMessageMetadata {
|
|
|
220
220
|
} | null;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-haiku-5-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | 'claude-sonnet-5-5' | (string & {});
|
|
223
|
+
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-haiku-5-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-fable-5-2' | 'claude-sonnet-5' | 'claude-sonnet-5-5' | (string & {});
|
|
224
224
|
/**
|
|
225
225
|
* Anthropic provider options for system messages.
|
|
226
226
|
*/
|
|
@@ -252,6 +252,7 @@ declare const anthropicSystemMessageProviderOptions: _ai_sdk_provider_utils.Lazy
|
|
|
252
252
|
type AnthropicSystemMessageProviderOptions = InferSchema<typeof anthropicSystemMessageProviderOptions>;
|
|
253
253
|
declare const anthropicLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
254
254
|
sendReasoning?: boolean | undefined;
|
|
255
|
+
allowInlineToolDefinitions?: boolean | undefined;
|
|
255
256
|
structuredOutputMode?: "auto" | "outputFormat" | "jsonTool" | undefined;
|
|
256
257
|
thinking?: {
|
|
257
258
|
type: "adaptive";
|
package/dist/index.d.ts
CHANGED
|
@@ -220,7 +220,7 @@ interface AnthropicMessageMetadata {
|
|
|
220
220
|
} | null;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-haiku-5-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-sonnet-5' | 'claude-sonnet-5-5' | (string & {});
|
|
223
|
+
type AnthropicMessagesModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-5' | 'claude-haiku-5-5' | 'claude-opus-4-0' | 'claude-opus-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-opus-4-1' | 'claude-opus-4-5' | 'claude-opus-4-5-20251101' | 'claude-sonnet-4-0' | 'claude-sonnet-4-20250514' | 'claude-sonnet-4-5-20250929' | 'claude-sonnet-4-5' | 'claude-sonnet-4-6' | 'claude-opus-4-6' | 'claude-opus-4-7' | 'claude-opus-4-8' | 'claude-opus-5' | 'claude-opus-5-5' | 'claude-fable-5' | 'claude-fable-5-1' | 'claude-fable-5-2' | 'claude-sonnet-5' | 'claude-sonnet-5-5' | (string & {});
|
|
224
224
|
/**
|
|
225
225
|
* Anthropic provider options for system messages.
|
|
226
226
|
*/
|
|
@@ -252,6 +252,7 @@ declare const anthropicSystemMessageProviderOptions: _ai_sdk_provider_utils.Lazy
|
|
|
252
252
|
type AnthropicSystemMessageProviderOptions = InferSchema<typeof anthropicSystemMessageProviderOptions>;
|
|
253
253
|
declare const anthropicLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
254
254
|
sendReasoning?: boolean | undefined;
|
|
255
|
+
allowInlineToolDefinitions?: boolean | undefined;
|
|
255
256
|
structuredOutputMode?: "auto" | "outputFormat" | "jsonTool" | undefined;
|
|
256
257
|
thinking?: {
|
|
257
258
|
type: "adaptive";
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
32
32
|
var import_provider_utils28 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.143" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/anthropic-messages-language-model.ts
|
|
38
38
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -936,7 +936,8 @@ var anthropicSystemMessageProviderOptions = (0, import_provider_utils3.lazySchem
|
|
|
936
936
|
* an entry of the `tools` option. The tool does not need to be declared
|
|
937
937
|
* in `tools`, and defining a tool under an existing name replaces it
|
|
938
938
|
* from that point on. The required `inline-tools-2026-09-15` beta is
|
|
939
|
-
* added automatically.
|
|
939
|
+
* added automatically. Requires the request-level
|
|
940
|
+
* `allowInlineToolDefinitions` option to be true.
|
|
940
941
|
*
|
|
941
942
|
* A `tool_removal` always references the tool by `toolName`.
|
|
942
943
|
*/
|
|
@@ -983,6 +984,13 @@ var anthropicLanguageModelOptions = (0, import_provider_utils3.lazySchema)(() =>
|
|
|
983
984
|
* This allows you to deactivate reasoning inputs for models that do not support them.
|
|
984
985
|
*/
|
|
985
986
|
sendReasoning: import_v43.z.boolean().optional(),
|
|
987
|
+
/**
|
|
988
|
+
* Allow tool definitions supplied by value in system-message tool changes.
|
|
989
|
+
* Defaults to false. Enable only for server-controlled messages: inline
|
|
990
|
+
* definitions can add tools or replace their configured restrictions.
|
|
991
|
+
* This request-level option cannot be enabled through message metadata.
|
|
992
|
+
*/
|
|
993
|
+
allowInlineToolDefinitions: import_v43.z.boolean().optional(),
|
|
986
994
|
/**
|
|
987
995
|
* Determines how structured outputs are generated.
|
|
988
996
|
*
|
|
@@ -998,7 +1006,7 @@ var anthropicLanguageModelOptions = (0, import_provider_utils3.lazySchema)(() =>
|
|
|
998
1006
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
999
1007
|
*
|
|
1000
1008
|
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
1001
|
-
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
1009
|
+
* `claude-fable-5-1`, `claude-fable-5-2`) reject `enabled` and `disabled`. For those models the
|
|
1002
1010
|
* provider drops the unsupported setting, emits a warning, and sends an
|
|
1003
1011
|
* adaptive thinking request. Use `effort` to control how much they think.
|
|
1004
1012
|
*
|
|
@@ -1372,10 +1380,17 @@ var computerToolset_20260801Members = [
|
|
|
1372
1380
|
"hold_key",
|
|
1373
1381
|
"wait"
|
|
1374
1382
|
];
|
|
1375
|
-
var computerToolset_20260801InputSchema = (0, import_provider_utils5.lazySchema)(
|
|
1383
|
+
var computerToolset_20260801InputSchema = (configs) => (0, import_provider_utils5.lazySchema)(
|
|
1376
1384
|
() => (0, import_provider_utils5.zodSchema)(
|
|
1377
1385
|
import_v45.z.object({
|
|
1378
|
-
action: import_v45.z.enum(
|
|
1386
|
+
action: import_v45.z.enum(
|
|
1387
|
+
computerToolset_20260801Members.filter(
|
|
1388
|
+
(member) => {
|
|
1389
|
+
var _a;
|
|
1390
|
+
return ((_a = configs == null ? void 0 : configs[member]) == null ? void 0 : _a.enabled) !== false;
|
|
1391
|
+
}
|
|
1392
|
+
)
|
|
1393
|
+
),
|
|
1379
1394
|
coordinate: import_v45.z.tuple([import_v45.z.number().int(), import_v45.z.number().int()]).optional(),
|
|
1380
1395
|
duration: import_v45.z.number().optional(),
|
|
1381
1396
|
region: import_v45.z.tuple([
|
|
@@ -1405,9 +1420,13 @@ var computerToolset_20260801ArgsSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
1405
1420
|
})
|
|
1406
1421
|
)
|
|
1407
1422
|
);
|
|
1408
|
-
var
|
|
1423
|
+
var factory2 = (0, import_provider_utils5.createProviderToolFactory)({
|
|
1409
1424
|
id: "anthropic.computer_toolset_20260801",
|
|
1410
|
-
inputSchema: computerToolset_20260801InputSchema
|
|
1425
|
+
inputSchema: computerToolset_20260801InputSchema()
|
|
1426
|
+
});
|
|
1427
|
+
var computerToolset_20260801 = (args) => ({
|
|
1428
|
+
...factory2(args),
|
|
1429
|
+
inputSchema: computerToolset_20260801InputSchema(args.configs)
|
|
1411
1430
|
});
|
|
1412
1431
|
|
|
1413
1432
|
// src/tool/text-editor_20250728.ts
|
|
@@ -1434,12 +1453,12 @@ var textEditor_20250728InputSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1434
1453
|
})
|
|
1435
1454
|
)
|
|
1436
1455
|
);
|
|
1437
|
-
var
|
|
1456
|
+
var factory3 = (0, import_provider_utils6.createProviderToolFactory)({
|
|
1438
1457
|
id: "anthropic.text_editor_20250728",
|
|
1439
1458
|
inputSchema: textEditor_20250728InputSchema
|
|
1440
1459
|
});
|
|
1441
1460
|
var textEditor_20250728 = (args = {}) => {
|
|
1442
|
-
return
|
|
1461
|
+
return factory3(args);
|
|
1443
1462
|
};
|
|
1444
1463
|
|
|
1445
1464
|
// src/tool/web-search_20260209.ts
|
|
@@ -1481,14 +1500,14 @@ var webSearch_20260209InputSchema = (0, import_provider_utils7.lazySchema)(
|
|
|
1481
1500
|
})
|
|
1482
1501
|
)
|
|
1483
1502
|
);
|
|
1484
|
-
var
|
|
1503
|
+
var factory4 = (0, import_provider_utils7.createProviderToolFactoryWithOutputSchema)({
|
|
1485
1504
|
id: "anthropic.web_search_20260209",
|
|
1486
1505
|
inputSchema: webSearch_20260209InputSchema,
|
|
1487
1506
|
outputSchema: webSearch_20260209OutputSchema,
|
|
1488
1507
|
supportsDeferredResults: true
|
|
1489
1508
|
});
|
|
1490
1509
|
var webSearch_20260209 = (args = {}) => {
|
|
1491
|
-
return
|
|
1510
|
+
return factory4(args);
|
|
1492
1511
|
};
|
|
1493
1512
|
|
|
1494
1513
|
// src/tool/web-search_20250305.ts
|
|
@@ -1530,14 +1549,14 @@ var webSearch_20250305InputSchema = (0, import_provider_utils8.lazySchema)(
|
|
|
1530
1549
|
})
|
|
1531
1550
|
)
|
|
1532
1551
|
);
|
|
1533
|
-
var
|
|
1552
|
+
var factory5 = (0, import_provider_utils8.createProviderToolFactoryWithOutputSchema)({
|
|
1534
1553
|
id: "anthropic.web_search_20250305",
|
|
1535
1554
|
inputSchema: webSearch_20250305InputSchema,
|
|
1536
1555
|
outputSchema: webSearch_20250305OutputSchema,
|
|
1537
1556
|
supportsDeferredResults: true
|
|
1538
1557
|
});
|
|
1539
1558
|
var webSearch_20250305 = (args = {}) => {
|
|
1540
|
-
return
|
|
1559
|
+
return factory5(args);
|
|
1541
1560
|
};
|
|
1542
1561
|
|
|
1543
1562
|
// src/tool/web-fetch-20260209.ts
|
|
@@ -1587,14 +1606,14 @@ var webFetch_20260209InputSchema = (0, import_provider_utils9.lazySchema)(
|
|
|
1587
1606
|
})
|
|
1588
1607
|
)
|
|
1589
1608
|
);
|
|
1590
|
-
var
|
|
1609
|
+
var factory6 = (0, import_provider_utils9.createProviderToolFactoryWithOutputSchema)({
|
|
1591
1610
|
id: "anthropic.web_fetch_20260209",
|
|
1592
1611
|
inputSchema: webFetch_20260209InputSchema,
|
|
1593
1612
|
outputSchema: webFetch_20260209OutputSchema,
|
|
1594
1613
|
supportsDeferredResults: true
|
|
1595
1614
|
});
|
|
1596
1615
|
var webFetch_20260209 = (args = {}) => {
|
|
1597
|
-
return
|
|
1616
|
+
return factory6(args);
|
|
1598
1617
|
};
|
|
1599
1618
|
|
|
1600
1619
|
// src/tool/web-fetch-20250910.ts
|
|
@@ -1644,14 +1663,14 @@ var webFetch_20250910InputSchema = (0, import_provider_utils10.lazySchema)(
|
|
|
1644
1663
|
})
|
|
1645
1664
|
)
|
|
1646
1665
|
);
|
|
1647
|
-
var
|
|
1666
|
+
var factory7 = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
|
|
1648
1667
|
id: "anthropic.web_fetch_20250910",
|
|
1649
1668
|
inputSchema: webFetch_20250910InputSchema,
|
|
1650
1669
|
outputSchema: webFetch_20250910OutputSchema,
|
|
1651
1670
|
supportsDeferredResults: true
|
|
1652
1671
|
});
|
|
1653
1672
|
var webFetch_20250910 = (args = {}) => {
|
|
1654
|
-
return
|
|
1673
|
+
return factory7(args);
|
|
1655
1674
|
};
|
|
1656
1675
|
|
|
1657
1676
|
// src/anthropic-prepare-tools.ts
|
|
@@ -2162,13 +2181,13 @@ var codeExecution_20250522InputSchema = (0, import_provider_utils12.lazySchema)(
|
|
|
2162
2181
|
})
|
|
2163
2182
|
)
|
|
2164
2183
|
);
|
|
2165
|
-
var
|
|
2184
|
+
var factory8 = (0, import_provider_utils12.createProviderToolFactoryWithOutputSchema)({
|
|
2166
2185
|
id: "anthropic.code_execution_20250522",
|
|
2167
2186
|
inputSchema: codeExecution_20250522InputSchema,
|
|
2168
2187
|
outputSchema: codeExecution_20250522OutputSchema
|
|
2169
2188
|
});
|
|
2170
2189
|
var codeExecution_20250522 = (args = {}) => {
|
|
2171
|
-
return
|
|
2190
|
+
return factory8(args);
|
|
2172
2191
|
};
|
|
2173
2192
|
|
|
2174
2193
|
// src/tool/code-execution_20250825.ts
|
|
@@ -2267,7 +2286,7 @@ var codeExecution_20250825InputSchema = (0, import_provider_utils13.lazySchema)(
|
|
|
2267
2286
|
])
|
|
2268
2287
|
)
|
|
2269
2288
|
);
|
|
2270
|
-
var
|
|
2289
|
+
var factory9 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSchema)({
|
|
2271
2290
|
id: "anthropic.code_execution_20250825",
|
|
2272
2291
|
inputSchema: codeExecution_20250825InputSchema,
|
|
2273
2292
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -2277,7 +2296,7 @@ var factory8 = (0, import_provider_utils13.createProviderToolFactoryWithOutputSc
|
|
|
2277
2296
|
supportsDeferredResults: true
|
|
2278
2297
|
});
|
|
2279
2298
|
var codeExecution_20250825 = (args = {}) => {
|
|
2280
|
-
return
|
|
2299
|
+
return factory9(args);
|
|
2281
2300
|
};
|
|
2282
2301
|
|
|
2283
2302
|
// src/tool/code-execution_20260120.ts
|
|
@@ -2387,14 +2406,14 @@ var codeExecution_20260120InputSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
2387
2406
|
])
|
|
2388
2407
|
)
|
|
2389
2408
|
);
|
|
2390
|
-
var
|
|
2409
|
+
var factory10 = (0, import_provider_utils14.createProviderToolFactoryWithOutputSchema)({
|
|
2391
2410
|
id: "anthropic.code_execution_20260120",
|
|
2392
2411
|
inputSchema: codeExecution_20260120InputSchema,
|
|
2393
2412
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
2394
2413
|
supportsDeferredResults: true
|
|
2395
2414
|
});
|
|
2396
2415
|
var codeExecution_20260120 = (args = {}) => {
|
|
2397
|
-
return
|
|
2416
|
+
return factory10(args);
|
|
2398
2417
|
};
|
|
2399
2418
|
|
|
2400
2419
|
// src/tool/tool-search-regex_20251119.ts
|
|
@@ -2431,14 +2450,14 @@ var toolSearchRegex_20251119InputSchema = (0, import_provider_utils15.lazySchema
|
|
|
2431
2450
|
})
|
|
2432
2451
|
)
|
|
2433
2452
|
);
|
|
2434
|
-
var
|
|
2453
|
+
var factory11 = (0, import_provider_utils15.createProviderToolFactoryWithOutputSchema)({
|
|
2435
2454
|
id: "anthropic.tool_search_regex_20251119",
|
|
2436
2455
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
2437
2456
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
2438
2457
|
supportsDeferredResults: true
|
|
2439
2458
|
});
|
|
2440
2459
|
var toolSearchRegex_20251119 = (args = {}) => {
|
|
2441
|
-
return
|
|
2460
|
+
return factory11(args);
|
|
2442
2461
|
};
|
|
2443
2462
|
|
|
2444
2463
|
// src/convert-to-anthropic-messages-prompt.ts
|
|
@@ -3978,6 +3997,22 @@ function isOpenObject(node) {
|
|
|
3978
3997
|
}
|
|
3979
3998
|
|
|
3980
3999
|
// src/anthropic-messages-language-model.ts
|
|
4000
|
+
function validateToolsetMember({
|
|
4001
|
+
toolsetName,
|
|
4002
|
+
memberName,
|
|
4003
|
+
tools
|
|
4004
|
+
}) {
|
|
4005
|
+
var _a, _b;
|
|
4006
|
+
const toolset = tools == null ? void 0 : tools.find(
|
|
4007
|
+
(tool) => "type" in tool && tool.type === "computer_toolset_20260801"
|
|
4008
|
+
);
|
|
4009
|
+
if (toolsetName !== "computer" || toolset == null || !computerToolset_20260801Members.some((member) => member === memberName) || ((_b = (_a = toolset.configs) == null ? void 0 : _a[memberName]) == null ? void 0 : _b.enabled) === false) {
|
|
4010
|
+
throw new import_provider3.InvalidResponseDataError({
|
|
4011
|
+
data: { toolsetName, memberName },
|
|
4012
|
+
message: `Received an unavailable toolset member: ${toolsetName}.${memberName}.`
|
|
4013
|
+
});
|
|
4014
|
+
}
|
|
4015
|
+
}
|
|
3981
4016
|
function createCitationSource(citation, citationDocuments, generateId3) {
|
|
3982
4017
|
var _a;
|
|
3983
4018
|
if (citation.type === "web_search_result_location") {
|
|
@@ -4045,9 +4080,15 @@ function toToolsetMemberInput({
|
|
|
4045
4080
|
memberName,
|
|
4046
4081
|
input
|
|
4047
4082
|
}) {
|
|
4083
|
+
if (typeof input !== "object" || input === null || Array.isArray(input)) {
|
|
4084
|
+
throw new import_provider3.InvalidResponseDataError({
|
|
4085
|
+
data: input,
|
|
4086
|
+
message: "Invalid toolset member input: expected an object."
|
|
4087
|
+
});
|
|
4088
|
+
}
|
|
4048
4089
|
return {
|
|
4049
|
-
|
|
4050
|
-
|
|
4090
|
+
...input,
|
|
4091
|
+
action: memberName
|
|
4051
4092
|
};
|
|
4052
4093
|
}
|
|
4053
4094
|
var TEXT_OR_THINKING_BLOCK_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -4327,6 +4368,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4327
4368
|
};
|
|
4328
4369
|
}
|
|
4329
4370
|
});
|
|
4371
|
+
const emittedInlineDefinitions = new Set(
|
|
4372
|
+
messagesPrompt.messages.flatMap(
|
|
4373
|
+
(message) => message.role === "system" ? message.content.flatMap(
|
|
4374
|
+
(part) => part.type === "tool_addition" && part.tool.type === "tool_definition" ? [part.tool.definition] : []
|
|
4375
|
+
) : []
|
|
4376
|
+
)
|
|
4377
|
+
);
|
|
4378
|
+
if (emittedInlineDefinitions.size > 0 && (anthropicOptions == null ? void 0 : anthropicOptions.allowInlineToolDefinitions) !== true) {
|
|
4379
|
+
throw new import_provider3.InvalidArgumentError({
|
|
4380
|
+
argument: "providerOptions.anthropic.allowInlineToolDefinitions",
|
|
4381
|
+
message: "Inline tool definitions require providerOptions.anthropic.allowInlineToolDefinitions to be true. Enable this option only for server-controlled messages, or declare tools in the tools option and add them by reference with toolName."
|
|
4382
|
+
});
|
|
4383
|
+
}
|
|
4330
4384
|
if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
|
|
4331
4385
|
const requestedThinking = anthropicOptions.thinking;
|
|
4332
4386
|
const requestedType = "type" in requestedThinking ? requestedThinking.type : void 0;
|
|
@@ -4671,13 +4725,6 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4671
4725
|
enabled: false
|
|
4672
4726
|
};
|
|
4673
4727
|
}
|
|
4674
|
-
const emittedInlineDefinitions = new Set(
|
|
4675
|
-
messagesPrompt.messages.flatMap(
|
|
4676
|
-
(message) => message.role === "system" ? message.content.flatMap(
|
|
4677
|
-
(part) => part.type === "tool_addition" && part.tool.type === "tool_definition" ? [part.tool.definition] : []
|
|
4678
|
-
) : []
|
|
4679
|
-
)
|
|
4680
|
-
);
|
|
4681
4728
|
const selectedSdkName = toolChoice.type === "tool" ? toolChoice.toolName : void 0;
|
|
4682
4729
|
const selectedTool = tools == null ? void 0 : tools.find((tool) => tool.name === selectedSdkName);
|
|
4683
4730
|
const selectedProviderName = jsonResponseTool != null && selectedSdkName != null && (selectedTool == null ? void 0 : selectedTool.type) !== "function" ? toolNameMapping.toProviderToolName(selectedSdkName) : selectedSdkName;
|
|
@@ -4889,6 +4936,11 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4889
4936
|
text: JSON.stringify(part.input)
|
|
4890
4937
|
});
|
|
4891
4938
|
} else if (part.toolset_name != null) {
|
|
4939
|
+
validateToolsetMember({
|
|
4940
|
+
toolsetName: part.toolset_name,
|
|
4941
|
+
memberName: part.name,
|
|
4942
|
+
tools: args.tools
|
|
4943
|
+
});
|
|
4892
4944
|
content.push({
|
|
4893
4945
|
type: "tool-call",
|
|
4894
4946
|
toolCallId: part.id,
|
|
@@ -5468,6 +5520,11 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5468
5520
|
id: String(value.index)
|
|
5469
5521
|
});
|
|
5470
5522
|
} else if (part.toolset_name != null) {
|
|
5523
|
+
validateToolsetMember({
|
|
5524
|
+
toolsetName: part.toolset_name,
|
|
5525
|
+
memberName: part.name,
|
|
5526
|
+
tools: body.tools
|
|
5527
|
+
});
|
|
5471
5528
|
const callerInfo = getAnthropicCallerInfo(part.caller);
|
|
5472
5529
|
const customToolName = toolNameMapping.toCustomToolName(
|
|
5473
5530
|
part.toolset_name
|
|
@@ -5883,9 +5940,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
5883
5940
|
try {
|
|
5884
5941
|
memberInput = contentBlock.input === "" ? {} : (0, import_provider_utils17.secureJsonParse)(contentBlock.input);
|
|
5885
5942
|
} catch (e) {
|
|
5886
|
-
|
|
5943
|
+
throw new import_provider3.InvalidResponseDataError({
|
|
5944
|
+
data: contentBlock.input,
|
|
5945
|
+
message: "Invalid toolset member input JSON."
|
|
5946
|
+
});
|
|
5887
5947
|
}
|
|
5888
|
-
contentBlock.input =
|
|
5948
|
+
contentBlock.input = JSON.stringify(
|
|
5889
5949
|
toToolsetMemberInput({
|
|
5890
5950
|
memberName: contentBlock.toolset.memberName,
|
|
5891
5951
|
input: memberInput
|
|
@@ -6343,7 +6403,7 @@ function getModelCapabilities(modelId) {
|
|
|
6343
6403
|
supportsBetweenToolsThinking: false,
|
|
6344
6404
|
isKnownModel: true
|
|
6345
6405
|
};
|
|
6346
|
-
} else if (modelId.includes("claude-fable-5-1")) {
|
|
6406
|
+
} else if (modelId.includes("claude-fable-5-2") || modelId.includes("claude-fable-5-1")) {
|
|
6347
6407
|
return {
|
|
6348
6408
|
maxOutputTokens: 128e3,
|
|
6349
6409
|
supportsStructuredOutput: true,
|
|
@@ -6826,14 +6886,14 @@ var toolSearchBm25_20251119InputSchema = (0, import_provider_utils27.lazySchema)
|
|
|
6826
6886
|
})
|
|
6827
6887
|
)
|
|
6828
6888
|
);
|
|
6829
|
-
var
|
|
6889
|
+
var factory12 = (0, import_provider_utils27.createProviderToolFactoryWithOutputSchema)({
|
|
6830
6890
|
id: "anthropic.tool_search_bm25_20251119",
|
|
6831
6891
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
6832
6892
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
6833
6893
|
supportsDeferredResults: true
|
|
6834
6894
|
});
|
|
6835
6895
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
6836
|
-
return
|
|
6896
|
+
return factory12(args);
|
|
6837
6897
|
};
|
|
6838
6898
|
|
|
6839
6899
|
// src/anthropic-tools.ts
|