@ai-sdk/anthropic 3.0.0-beta.70 → 3.0.0-beta.72

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.
@@ -39,8 +39,6 @@ declare const anthropicTools: {
39
39
  * allowing system operations, script execution, and command-line automation.
40
40
  *
41
41
  * Image results are supported.
42
- *
43
- * Tool name must be `bash`.
44
42
  */
45
43
  bash_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
46
44
  command: string;
@@ -51,8 +49,6 @@ declare const anthropicTools: {
51
49
  * allowing system operations, script execution, and command-line automation.
52
50
  *
53
51
  * Image results are supported.
54
- *
55
- * Tool name must be `bash`.
56
52
  */
57
53
  bash_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
58
54
  command: string;
@@ -65,8 +61,6 @@ declare const anthropicTools: {
65
61
  *
66
62
  * The code execution tool allows Claude to run Bash commands and manipulate files,
67
63
  * including writing code, in a secure, sandboxed environment.
68
- *
69
- * Tool name must be `code_execution`.
70
64
  */
71
65
  codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
72
66
  code: string;
@@ -92,8 +86,6 @@ declare const anthropicTools: {
92
86
  * including writing code, in a secure, sandboxed environment.
93
87
  *
94
88
  * This is the latest version with enhanced Bash support and file operations.
95
- *
96
- * Tool name must be `code_execution`.
97
89
  */
98
90
  codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
99
91
  type: "bash_code_execution";
@@ -202,8 +194,6 @@ declare const anthropicTools: {
202
194
  *
203
195
  * Image results are supported.
204
196
  *
205
- * Tool name must be `computer`.
206
- *
207
197
  * @param displayWidthPx - The width of the display being controlled by the model in pixels.
208
198
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
209
199
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
@@ -223,8 +213,6 @@ declare const anthropicTools: {
223
213
  *
224
214
  * Image results are supported.
225
215
  *
226
- * Tool name must be `computer`.
227
- *
228
216
  * @param displayWidthPx - The width of the display being controlled by the model in pixels.
229
217
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
230
218
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
@@ -249,8 +237,6 @@ declare const anthropicTools: {
249
237
  * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
250
238
  *
251
239
  * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
252
- *
253
- * Tool name must be `memory`.
254
240
  */
255
241
  memory_20250818: _ai_sdk_provider_utils.ProviderToolFactory<{
256
242
  command: "view";
@@ -284,8 +270,6 @@ declare const anthropicTools: {
284
270
  * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
285
271
  *
286
272
  * Supported models: Claude Sonnet 3.5
287
- *
288
- * Tool name must be `str_replace_editor`.
289
273
  */
290
274
  textEditor_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
291
275
  command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
@@ -302,8 +286,6 @@ declare const anthropicTools: {
302
286
  * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
303
287
  *
304
288
  * Supported models: Claude Sonnet 3.7
305
- *
306
- * Tool name must be `str_replace_editor`.
307
289
  */
308
290
  textEditor_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
309
291
  command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
@@ -321,8 +303,6 @@ declare const anthropicTools: {
321
303
  *
322
304
  * Note: This version does not support the "undo_edit" command.
323
305
  *
324
- * Tool name must be `str_replace_based_edit_tool`.
325
- *
326
306
  * @deprecated Use textEditor_20250728 instead
327
307
  */
328
308
  textEditor_20250429: _ai_sdk_provider_utils.ProviderToolFactory<{
@@ -343,8 +323,6 @@ declare const anthropicTools: {
343
323
  *
344
324
  * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
345
325
  *
346
- * Tool name must be `str_replace_based_edit_tool`.
347
- *
348
326
  * @param maxCharacters - Optional maximum number of characters to view in the file
349
327
  */
350
328
  textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactory<{
@@ -369,8 +347,6 @@ declare const anthropicTools: {
369
347
  /**
370
348
  * Creates a web fetch tool that gives Claude direct access to real-time web content.
371
349
  *
372
- * Tool name must be `web_fetch`.
373
- *
374
350
  * @param maxUses - The max_uses parameter limits the number of web fetches performed
375
351
  * @param allowedDomains - Only fetch from these domains
376
352
  * @param blockedDomains - Never fetch from these domains
@@ -433,8 +409,6 @@ declare const anthropicTools: {
433
409
  /**
434
410
  * Creates a web search tool that gives Claude direct access to real-time web content.
435
411
  *
436
- * Tool name must be `web_search`.
437
- *
438
412
  * @param maxUses - Maximum number of web searches Claude can perform during the conversation.
439
413
  * @param allowedDomains - Optional list of domains that Claude is allowed to search.
440
414
  * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
@@ -479,6 +453,7 @@ type AnthropicTool = {
479
453
  description: string | undefined;
480
454
  input_schema: JSONSchema7;
481
455
  cache_control: AnthropicCacheControl | undefined;
456
+ strict?: boolean;
482
457
  } | {
483
458
  type: 'code_execution_20250522';
484
459
  name: string;
@@ -554,11 +529,15 @@ declare class CacheControlValidator {
554
529
  getWarnings(): SharedV3Warning[];
555
530
  }
556
531
 
557
- declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, }: {
532
+ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, }: {
558
533
  tools: LanguageModelV3CallOptions['tools'];
559
534
  toolChoice: LanguageModelV3CallOptions['toolChoice'] | undefined;
560
535
  disableParallelToolUse?: boolean;
561
536
  cacheControlValidator?: CacheControlValidator;
537
+ /**
538
+ * Whether the model supports structured output.
539
+ */
540
+ supportsStructuredOutput: boolean;
562
541
  }): Promise<{
563
542
  tools: Array<AnthropicTool> | undefined;
564
543
  toolChoice: AnthropicToolChoice | undefined;
@@ -39,8 +39,6 @@ declare const anthropicTools: {
39
39
  * allowing system operations, script execution, and command-line automation.
40
40
  *
41
41
  * Image results are supported.
42
- *
43
- * Tool name must be `bash`.
44
42
  */
45
43
  bash_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
46
44
  command: string;
@@ -51,8 +49,6 @@ declare const anthropicTools: {
51
49
  * allowing system operations, script execution, and command-line automation.
52
50
  *
53
51
  * Image results are supported.
54
- *
55
- * Tool name must be `bash`.
56
52
  */
57
53
  bash_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
58
54
  command: string;
@@ -65,8 +61,6 @@ declare const anthropicTools: {
65
61
  *
66
62
  * The code execution tool allows Claude to run Bash commands and manipulate files,
67
63
  * including writing code, in a secure, sandboxed environment.
68
- *
69
- * Tool name must be `code_execution`.
70
64
  */
71
65
  codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
72
66
  code: string;
@@ -92,8 +86,6 @@ declare const anthropicTools: {
92
86
  * including writing code, in a secure, sandboxed environment.
93
87
  *
94
88
  * This is the latest version with enhanced Bash support and file operations.
95
- *
96
- * Tool name must be `code_execution`.
97
89
  */
98
90
  codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
99
91
  type: "bash_code_execution";
@@ -202,8 +194,6 @@ declare const anthropicTools: {
202
194
  *
203
195
  * Image results are supported.
204
196
  *
205
- * Tool name must be `computer`.
206
- *
207
197
  * @param displayWidthPx - The width of the display being controlled by the model in pixels.
208
198
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
209
199
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
@@ -223,8 +213,6 @@ declare const anthropicTools: {
223
213
  *
224
214
  * Image results are supported.
225
215
  *
226
- * Tool name must be `computer`.
227
- *
228
216
  * @param displayWidthPx - The width of the display being controlled by the model in pixels.
229
217
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
230
218
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
@@ -249,8 +237,6 @@ declare const anthropicTools: {
249
237
  * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
250
238
  *
251
239
  * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
252
- *
253
- * Tool name must be `memory`.
254
240
  */
255
241
  memory_20250818: _ai_sdk_provider_utils.ProviderToolFactory<{
256
242
  command: "view";
@@ -284,8 +270,6 @@ declare const anthropicTools: {
284
270
  * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
285
271
  *
286
272
  * Supported models: Claude Sonnet 3.5
287
- *
288
- * Tool name must be `str_replace_editor`.
289
273
  */
290
274
  textEditor_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
291
275
  command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
@@ -302,8 +286,6 @@ declare const anthropicTools: {
302
286
  * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
303
287
  *
304
288
  * Supported models: Claude Sonnet 3.7
305
- *
306
- * Tool name must be `str_replace_editor`.
307
289
  */
308
290
  textEditor_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
309
291
  command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
@@ -321,8 +303,6 @@ declare const anthropicTools: {
321
303
  *
322
304
  * Note: This version does not support the "undo_edit" command.
323
305
  *
324
- * Tool name must be `str_replace_based_edit_tool`.
325
- *
326
306
  * @deprecated Use textEditor_20250728 instead
327
307
  */
328
308
  textEditor_20250429: _ai_sdk_provider_utils.ProviderToolFactory<{
@@ -343,8 +323,6 @@ declare const anthropicTools: {
343
323
  *
344
324
  * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
345
325
  *
346
- * Tool name must be `str_replace_based_edit_tool`.
347
- *
348
326
  * @param maxCharacters - Optional maximum number of characters to view in the file
349
327
  */
350
328
  textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactory<{
@@ -369,8 +347,6 @@ declare const anthropicTools: {
369
347
  /**
370
348
  * Creates a web fetch tool that gives Claude direct access to real-time web content.
371
349
  *
372
- * Tool name must be `web_fetch`.
373
- *
374
350
  * @param maxUses - The max_uses parameter limits the number of web fetches performed
375
351
  * @param allowedDomains - Only fetch from these domains
376
352
  * @param blockedDomains - Never fetch from these domains
@@ -433,8 +409,6 @@ declare const anthropicTools: {
433
409
  /**
434
410
  * Creates a web search tool that gives Claude direct access to real-time web content.
435
411
  *
436
- * Tool name must be `web_search`.
437
- *
438
412
  * @param maxUses - Maximum number of web searches Claude can perform during the conversation.
439
413
  * @param allowedDomains - Optional list of domains that Claude is allowed to search.
440
414
  * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
@@ -479,6 +453,7 @@ type AnthropicTool = {
479
453
  description: string | undefined;
480
454
  input_schema: JSONSchema7;
481
455
  cache_control: AnthropicCacheControl | undefined;
456
+ strict?: boolean;
482
457
  } | {
483
458
  type: 'code_execution_20250522';
484
459
  name: string;
@@ -554,11 +529,15 @@ declare class CacheControlValidator {
554
529
  getWarnings(): SharedV3Warning[];
555
530
  }
556
531
 
557
- declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, }: {
532
+ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, }: {
558
533
  tools: LanguageModelV3CallOptions['tools'];
559
534
  toolChoice: LanguageModelV3CallOptions['toolChoice'] | undefined;
560
535
  disableParallelToolUse?: boolean;
561
536
  cacheControlValidator?: CacheControlValidator;
537
+ /**
538
+ * Whether the model supports structured output.
539
+ */
540
+ supportsStructuredOutput: boolean;
562
541
  }): Promise<{
563
542
  tools: Array<AnthropicTool> | undefined;
564
543
  toolChoice: AnthropicToolChoice | undefined;
@@ -849,7 +849,8 @@ async function prepareTools({
849
849
  tools,
850
850
  toolChoice,
851
851
  disableParallelToolUse,
852
- cacheControlValidator
852
+ cacheControlValidator,
853
+ supportsStructuredOutput
853
854
  }) {
854
855
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
855
856
  const toolWarnings = [];
@@ -870,7 +871,8 @@ async function prepareTools({
870
871
  name: tool.name,
871
872
  description: tool.description,
872
873
  input_schema: tool.inputSchema,
873
- cache_control: cacheControl
874
+ cache_control: cacheControl,
875
+ ...supportsStructuredOutput === true && tool.strict != null ? { strict: tool.strict } : {}
874
876
  });
875
877
  break;
876
878
  }
@@ -2132,12 +2134,14 @@ var AnthropicMessagesLanguageModel = class {
2132
2134
  tools: [...tools != null ? tools : [], jsonResponseTool],
2133
2135
  toolChoice: { type: "required" },
2134
2136
  disableParallelToolUse: true,
2135
- cacheControlValidator
2137
+ cacheControlValidator,
2138
+ supportsStructuredOutput
2136
2139
  } : {
2137
2140
  tools: tools != null ? tools : [],
2138
2141
  toolChoice,
2139
2142
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
2140
- cacheControlValidator
2143
+ cacheControlValidator,
2144
+ supportsStructuredOutput
2141
2145
  }
2142
2146
  );
2143
2147
  const cacheWarnings = cacheControlValidator.getWarnings();
@@ -3302,8 +3306,6 @@ var anthropicTools = {
3302
3306
  * allowing system operations, script execution, and command-line automation.
3303
3307
  *
3304
3308
  * Image results are supported.
3305
- *
3306
- * Tool name must be `bash`.
3307
3309
  */
3308
3310
  bash_20241022,
3309
3311
  /**
@@ -3311,8 +3313,6 @@ var anthropicTools = {
3311
3313
  * allowing system operations, script execution, and command-line automation.
3312
3314
  *
3313
3315
  * Image results are supported.
3314
- *
3315
- * Tool name must be `bash`.
3316
3316
  */
3317
3317
  bash_20250124,
3318
3318
  /**
@@ -3322,8 +3322,6 @@ var anthropicTools = {
3322
3322
  *
3323
3323
  * The code execution tool allows Claude to run Bash commands and manipulate files,
3324
3324
  * including writing code, in a secure, sandboxed environment.
3325
- *
3326
- * Tool name must be `code_execution`.
3327
3325
  */
3328
3326
  codeExecution_20250522,
3329
3327
  /**
@@ -3335,8 +3333,6 @@ var anthropicTools = {
3335
3333
  * including writing code, in a secure, sandboxed environment.
3336
3334
  *
3337
3335
  * This is the latest version with enhanced Bash support and file operations.
3338
- *
3339
- * Tool name must be `code_execution`.
3340
3336
  */
3341
3337
  codeExecution_20250825,
3342
3338
  /**
@@ -3345,8 +3341,6 @@ var anthropicTools = {
3345
3341
  *
3346
3342
  * Image results are supported.
3347
3343
  *
3348
- * Tool name must be `computer`.
3349
- *
3350
3344
  * @param displayWidthPx - The width of the display being controlled by the model in pixels.
3351
3345
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
3352
3346
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
@@ -3358,8 +3352,6 @@ var anthropicTools = {
3358
3352
  *
3359
3353
  * Image results are supported.
3360
3354
  *
3361
- * Tool name must be `computer`.
3362
- *
3363
3355
  * @param displayWidthPx - The width of the display being controlled by the model in pixels.
3364
3356
  * @param displayHeightPx - The height of the display being controlled by the model in pixels.
3365
3357
  * @param displayNumber - The display number to control (only relevant for X11 environments). If specified, the tool will be provided a display number in the tool definition.
@@ -3372,8 +3364,6 @@ var anthropicTools = {
3372
3364
  * The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
3373
3365
  *
3374
3366
  * Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
3375
- *
3376
- * Tool name must be `memory`.
3377
3367
  */
3378
3368
  memory_20250818,
3379
3369
  /**
@@ -3382,8 +3372,6 @@ var anthropicTools = {
3382
3372
  * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
3383
3373
  *
3384
3374
  * Supported models: Claude Sonnet 3.5
3385
- *
3386
- * Tool name must be `str_replace_editor`.
3387
3375
  */
3388
3376
  textEditor_20241022,
3389
3377
  /**
@@ -3392,8 +3380,6 @@ var anthropicTools = {
3392
3380
  * to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
3393
3381
  *
3394
3382
  * Supported models: Claude Sonnet 3.7
3395
- *
3396
- * Tool name must be `str_replace_editor`.
3397
3383
  */
3398
3384
  textEditor_20250124,
3399
3385
  /**
@@ -3403,8 +3389,6 @@ var anthropicTools = {
3403
3389
  *
3404
3390
  * Note: This version does not support the "undo_edit" command.
3405
3391
  *
3406
- * Tool name must be `str_replace_based_edit_tool`.
3407
- *
3408
3392
  * @deprecated Use textEditor_20250728 instead
3409
3393
  */
3410
3394
  textEditor_20250429,
@@ -3417,16 +3401,12 @@ var anthropicTools = {
3417
3401
  *
3418
3402
  * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
3419
3403
  *
3420
- * Tool name must be `str_replace_based_edit_tool`.
3421
- *
3422
3404
  * @param maxCharacters - Optional maximum number of characters to view in the file
3423
3405
  */
3424
3406
  textEditor_20250728,
3425
3407
  /**
3426
3408
  * Creates a web fetch tool that gives Claude direct access to real-time web content.
3427
3409
  *
3428
- * Tool name must be `web_fetch`.
3429
- *
3430
3410
  * @param maxUses - The max_uses parameter limits the number of web fetches performed
3431
3411
  * @param allowedDomains - Only fetch from these domains
3432
3412
  * @param blockedDomains - Never fetch from these domains
@@ -3437,8 +3417,6 @@ var anthropicTools = {
3437
3417
  /**
3438
3418
  * Creates a web search tool that gives Claude direct access to real-time web content.
3439
3419
  *
3440
- * Tool name must be `web_search`.
3441
- *
3442
3420
  * @param maxUses - Maximum number of web searches Claude can perform during the conversation.
3443
3421
  * @param allowedDomains - Optional list of domains that Claude is allowed to search.
3444
3422
  * @param blockedDomains - Optional list of domains that Claude should avoid when searching.