@fairyhunter13/ai-anthropic 3.0.58-fork.8 → 3.0.74-fork
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 +277 -0
- package/README.md +2 -0
- package/dist/index.d.ts +156 -67
- package/dist/index.js +2190 -1471
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +167 -58
- package/dist/internal/index.js +1950 -1458
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +116 -13
- package/package.json +15 -12
- package/src/{anthropic-messages-api.ts → anthropic-api.ts} +46 -15
- package/src/anthropic-error.ts +1 -1
- package/src/anthropic-files.ts +95 -0
- package/src/{anthropic-messages-options.ts → anthropic-language-model-options.ts} +80 -41
- package/src/{anthropic-messages-language-model.ts → anthropic-language-model.ts} +221 -138
- package/src/anthropic-message-metadata.ts +2 -1
- package/src/anthropic-prepare-tools.ts +68 -26
- package/src/anthropic-provider.ts +42 -13
- package/src/anthropic-tools.ts +18 -0
- package/src/{convert-anthropic-messages-usage.ts → convert-anthropic-usage.ts} +4 -4
- package/src/{convert-to-anthropic-messages-prompt.ts → convert-to-anthropic-prompt.ts} +233 -180
- package/src/forward-anthropic-container-id-from-last-step.ts +2 -2
- package/src/get-cache-control.ts +5 -2
- package/src/index.ts +1 -1
- package/src/internal/index.ts +9 -3
- package/src/map-anthropic-stop-reason.ts +1 -1
- package/src/sanitize-json-schema.ts +203 -0
- package/src/skills/anthropic-skills-api.ts +44 -0
- package/src/skills/anthropic-skills.ts +132 -0
- package/src/tool/bash_20241022.ts +2 -2
- package/src/tool/bash_20250124.ts +2 -2
- package/src/tool/code-execution_20250522.ts +2 -2
- package/src/tool/code-execution_20250825.ts +2 -2
- package/src/tool/code-execution_20260120.ts +2 -2
- package/src/tool/computer_20241022.ts +2 -2
- package/src/tool/computer_20250124.ts +2 -2
- package/src/tool/computer_20251124.ts +2 -2
- package/src/tool/memory_20250818.ts +2 -2
- package/src/tool/text-editor_20241022.ts +2 -2
- package/src/tool/text-editor_20250124.ts +2 -2
- package/src/tool/text-editor_20250429.ts +2 -2
- package/src/tool/text-editor_20250728.ts +6 -3
- package/src/tool/tool-search-bm25_20251119.ts +2 -2
- package/src/tool/tool-search-regex_20251119.ts +2 -2
- package/src/tool/web-fetch-20250910.ts +2 -2
- package/src/tool/web-fetch-20260209.ts +2 -2
- package/src/tool/web-fetch-20260309.ts +181 -0
- package/src/tool/web-search_20250305.ts +2 -2
- package/src/tool/web-search_20260209.ts +19 -2
- package/dist/index.d.mts +0 -1105
- package/dist/index.mjs +0 -5394
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -981
- package/dist/internal/index.mjs +0 -5287
- package/dist/internal/index.mjs.map +0 -1
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, JSONSchema7, SharedV4ProviderMetadata, SharedV4Warning } from '@ai-sdk/provider';
|
|
1
|
+
import { LanguageModelV4, JSONObject, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, JSONSchema7, SharedV4ProviderMetadata, SharedV4Warning } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
-
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
type
|
|
5
|
+
type AnthropicModelId = 'claude-3-haiku-20240307' | 'claude-haiku-4-5-20251001' | 'claude-haiku-4-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' | (string & {});
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
type AnthropicLanguageModelConfig = {
|
|
8
8
|
provider: string;
|
|
9
9
|
baseURL: string;
|
|
10
|
-
headers
|
|
10
|
+
headers?: Resolvable<Record<string, string | undefined>>;
|
|
11
11
|
fetch?: FetchFunction;
|
|
12
12
|
buildRequestUrl?: (baseURL: string, isStreaming: boolean) => string;
|
|
13
13
|
transformRequestBody?: (args: Record<string, any>, betas: Set<string>) => Record<string, any>;
|
|
@@ -23,12 +23,20 @@ type AnthropicMessagesConfig = {
|
|
|
23
23
|
*/
|
|
24
24
|
supportsStrictTools?: boolean;
|
|
25
25
|
};
|
|
26
|
-
declare class
|
|
26
|
+
declare class AnthropicLanguageModel implements LanguageModelV4 {
|
|
27
27
|
readonly specificationVersion = "v4";
|
|
28
|
-
readonly modelId:
|
|
28
|
+
readonly modelId: AnthropicModelId;
|
|
29
29
|
private readonly config;
|
|
30
30
|
private readonly generateId;
|
|
31
|
-
|
|
31
|
+
static [WORKFLOW_SERIALIZE](model: AnthropicLanguageModel): {
|
|
32
|
+
modelId: string;
|
|
33
|
+
config: JSONObject;
|
|
34
|
+
};
|
|
35
|
+
static [WORKFLOW_DESERIALIZE](options: {
|
|
36
|
+
modelId: AnthropicModelId;
|
|
37
|
+
config: AnthropicLanguageModelConfig;
|
|
38
|
+
}): AnthropicLanguageModel;
|
|
39
|
+
constructor(modelId: AnthropicModelId, config: AnthropicLanguageModelConfig);
|
|
32
40
|
supportsUrl(url: URL): boolean;
|
|
33
41
|
get provider(): string;
|
|
34
42
|
/**
|
|
@@ -56,6 +64,8 @@ declare function getModelCapabilities(modelId: string): {
|
|
|
56
64
|
maxOutputTokens: number;
|
|
57
65
|
supportsStructuredOutput: boolean;
|
|
58
66
|
supportsAdaptiveThinking: boolean;
|
|
67
|
+
rejectsSamplingParameters: boolean;
|
|
68
|
+
supportsXhighEffort: boolean;
|
|
59
69
|
isKnownModel: boolean;
|
|
60
70
|
};
|
|
61
71
|
|
|
@@ -66,20 +76,20 @@ declare const anthropicTools: {
|
|
|
66
76
|
*
|
|
67
77
|
* Image results are supported.
|
|
68
78
|
*/
|
|
69
|
-
bash_20241022: _ai_sdk_provider_utils.
|
|
79
|
+
bash_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
70
80
|
command: string;
|
|
71
81
|
restart?: boolean;
|
|
72
|
-
}, {}>;
|
|
82
|
+
}, {}, {}>;
|
|
73
83
|
/**
|
|
74
84
|
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
75
85
|
* allowing system operations, script execution, and command-line automation.
|
|
76
86
|
*
|
|
77
87
|
* Image results are supported.
|
|
78
88
|
*/
|
|
79
|
-
bash_20250124: _ai_sdk_provider_utils.
|
|
89
|
+
bash_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
80
90
|
command: string;
|
|
81
91
|
restart?: boolean;
|
|
82
|
-
}, {}>;
|
|
92
|
+
}, {}, {}>;
|
|
83
93
|
/**
|
|
84
94
|
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
85
95
|
* run system commands, create and edit files, and process uploaded files directly within
|
|
@@ -88,7 +98,7 @@ declare const anthropicTools: {
|
|
|
88
98
|
* The code execution tool allows Claude to run Bash commands and manipulate files,
|
|
89
99
|
* including writing code, in a secure, sandboxed environment.
|
|
90
100
|
*/
|
|
91
|
-
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.
|
|
101
|
+
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
92
102
|
code: string;
|
|
93
103
|
}, {
|
|
94
104
|
type: "code_execution_result";
|
|
@@ -99,7 +109,7 @@ declare const anthropicTools: {
|
|
|
99
109
|
type: "code_execution_output";
|
|
100
110
|
file_id: string;
|
|
101
111
|
}>;
|
|
102
|
-
}, {}>>[0]) => _ai_sdk_provider_utils.
|
|
112
|
+
}, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
103
113
|
code: string;
|
|
104
114
|
}, {
|
|
105
115
|
type: "code_execution_result";
|
|
@@ -110,7 +120,7 @@ declare const anthropicTools: {
|
|
|
110
120
|
type: "code_execution_output";
|
|
111
121
|
file_id: string;
|
|
112
122
|
}>;
|
|
113
|
-
}>;
|
|
123
|
+
}, {}>;
|
|
114
124
|
/**
|
|
115
125
|
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
116
126
|
* run system commands, create and edit files, and process uploaded files directly within
|
|
@@ -121,7 +131,7 @@ declare const anthropicTools: {
|
|
|
121
131
|
*
|
|
122
132
|
* This is the latest version with enhanced Bash support and file operations.
|
|
123
133
|
*/
|
|
124
|
-
codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.
|
|
134
|
+
codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
125
135
|
type: "programmatic-tool-call";
|
|
126
136
|
code: string;
|
|
127
137
|
} | {
|
|
@@ -183,7 +193,7 @@ declare const anthropicTools: {
|
|
|
183
193
|
new_start: number | null;
|
|
184
194
|
old_lines: number | null;
|
|
185
195
|
old_start: number | null;
|
|
186
|
-
}, {}>>[0]) => _ai_sdk_provider_utils.
|
|
196
|
+
}, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
187
197
|
type: "programmatic-tool-call";
|
|
188
198
|
code: string;
|
|
189
199
|
} | {
|
|
@@ -245,7 +255,7 @@ declare const anthropicTools: {
|
|
|
245
255
|
new_start: number | null;
|
|
246
256
|
old_lines: number | null;
|
|
247
257
|
old_start: number | null;
|
|
248
|
-
}>;
|
|
258
|
+
}, {}>;
|
|
249
259
|
/**
|
|
250
260
|
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
251
261
|
* run system commands, create and edit files, and process uploaded files directly within
|
|
@@ -258,7 +268,7 @@ declare const anthropicTools: {
|
|
|
258
268
|
*
|
|
259
269
|
* Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
|
|
260
270
|
*/
|
|
261
|
-
codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.
|
|
271
|
+
codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
262
272
|
type: "programmatic-tool-call";
|
|
263
273
|
code: string;
|
|
264
274
|
} | {
|
|
@@ -329,7 +339,7 @@ declare const anthropicTools: {
|
|
|
329
339
|
new_start: number | null;
|
|
330
340
|
old_lines: number | null;
|
|
331
341
|
old_start: number | null;
|
|
332
|
-
}, {}>>[0]) => _ai_sdk_provider_utils.
|
|
342
|
+
}, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
333
343
|
type: "programmatic-tool-call";
|
|
334
344
|
code: string;
|
|
335
345
|
} | {
|
|
@@ -400,7 +410,7 @@ declare const anthropicTools: {
|
|
|
400
410
|
new_start: number | null;
|
|
401
411
|
old_lines: number | null;
|
|
402
412
|
old_start: number | null;
|
|
403
|
-
}>;
|
|
413
|
+
}, {}>;
|
|
404
414
|
/**
|
|
405
415
|
* Claude can interact with computer environments through the computer use tool, which
|
|
406
416
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -411,7 +421,7 @@ declare const anthropicTools: {
|
|
|
411
421
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
412
422
|
* @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.
|
|
413
423
|
*/
|
|
414
|
-
computer_20241022: _ai_sdk_provider_utils.
|
|
424
|
+
computer_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
415
425
|
action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
|
|
416
426
|
coordinate?: number[];
|
|
417
427
|
text?: string;
|
|
@@ -419,7 +429,7 @@ declare const anthropicTools: {
|
|
|
419
429
|
displayWidthPx: number;
|
|
420
430
|
displayHeightPx: number;
|
|
421
431
|
displayNumber?: number;
|
|
422
|
-
}>;
|
|
432
|
+
}, {}>;
|
|
423
433
|
/**
|
|
424
434
|
* Claude can interact with computer environments through the computer use tool, which
|
|
425
435
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -430,7 +440,7 @@ declare const anthropicTools: {
|
|
|
430
440
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
431
441
|
* @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.
|
|
432
442
|
*/
|
|
433
|
-
computer_20250124: _ai_sdk_provider_utils.
|
|
443
|
+
computer_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
434
444
|
action: "key" | "hold_key" | "type" | "cursor_position" | "mouse_move" | "left_mouse_down" | "left_mouse_up" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "triple_click" | "scroll" | "wait" | "screenshot";
|
|
435
445
|
coordinate?: [number, number];
|
|
436
446
|
duration?: number;
|
|
@@ -442,7 +452,7 @@ declare const anthropicTools: {
|
|
|
442
452
|
displayWidthPx: number;
|
|
443
453
|
displayHeightPx: number;
|
|
444
454
|
displayNumber?: number;
|
|
445
|
-
}>;
|
|
455
|
+
}, {}>;
|
|
446
456
|
/**
|
|
447
457
|
* Claude can interact with computer environments through the computer use tool, which
|
|
448
458
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -458,7 +468,7 @@ declare const anthropicTools: {
|
|
|
458
468
|
* @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.
|
|
459
469
|
* @param enableZoom - Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
|
|
460
470
|
*/
|
|
461
|
-
computer_20251124: _ai_sdk_provider_utils.
|
|
471
|
+
computer_20251124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
462
472
|
action: "key" | "hold_key" | "type" | "cursor_position" | "mouse_move" | "left_mouse_down" | "left_mouse_up" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "triple_click" | "scroll" | "wait" | "screenshot" | "zoom";
|
|
463
473
|
coordinate?: [number, number];
|
|
464
474
|
duration?: number;
|
|
@@ -472,7 +482,7 @@ declare const anthropicTools: {
|
|
|
472
482
|
displayHeightPx: number;
|
|
473
483
|
displayNumber?: number;
|
|
474
484
|
enableZoom?: boolean;
|
|
475
|
-
}>;
|
|
485
|
+
}, {}>;
|
|
476
486
|
/**
|
|
477
487
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
478
488
|
* Claude can create, read, update, and delete files that persist between sessions,
|
|
@@ -481,7 +491,7 @@ declare const anthropicTools: {
|
|
|
481
491
|
*
|
|
482
492
|
* Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
|
|
483
493
|
*/
|
|
484
|
-
memory_20250818: _ai_sdk_provider_utils.
|
|
494
|
+
memory_20250818: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
485
495
|
command: "view";
|
|
486
496
|
path: string;
|
|
487
497
|
view_range?: [number, number];
|
|
@@ -506,7 +516,7 @@ declare const anthropicTools: {
|
|
|
506
516
|
command: "rename";
|
|
507
517
|
old_path: string;
|
|
508
518
|
new_path: string;
|
|
509
|
-
}, {}>;
|
|
519
|
+
}, {}, {}>;
|
|
510
520
|
/**
|
|
511
521
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
512
522
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
@@ -514,7 +524,7 @@ declare const anthropicTools: {
|
|
|
514
524
|
*
|
|
515
525
|
* Supported models: Claude Sonnet 3.5
|
|
516
526
|
*/
|
|
517
|
-
textEditor_20241022: _ai_sdk_provider_utils.
|
|
527
|
+
textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
518
528
|
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
519
529
|
path: string;
|
|
520
530
|
file_text?: string;
|
|
@@ -523,7 +533,7 @@ declare const anthropicTools: {
|
|
|
523
533
|
insert_text?: string;
|
|
524
534
|
old_str?: string;
|
|
525
535
|
view_range?: number[];
|
|
526
|
-
}, {}>;
|
|
536
|
+
}, {}, {}>;
|
|
527
537
|
/**
|
|
528
538
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
529
539
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
@@ -531,7 +541,7 @@ declare const anthropicTools: {
|
|
|
531
541
|
*
|
|
532
542
|
* Supported models: Claude Sonnet 3.7
|
|
533
543
|
*/
|
|
534
|
-
textEditor_20250124: _ai_sdk_provider_utils.
|
|
544
|
+
textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
535
545
|
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
536
546
|
path: string;
|
|
537
547
|
file_text?: string;
|
|
@@ -540,7 +550,7 @@ declare const anthropicTools: {
|
|
|
540
550
|
insert_text?: string;
|
|
541
551
|
old_str?: string;
|
|
542
552
|
view_range?: number[];
|
|
543
|
-
}, {}>;
|
|
553
|
+
}, {}, {}>;
|
|
544
554
|
/**
|
|
545
555
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
546
556
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
@@ -550,7 +560,7 @@ declare const anthropicTools: {
|
|
|
550
560
|
*
|
|
551
561
|
* @deprecated Use textEditor_20250728 instead
|
|
552
562
|
*/
|
|
553
|
-
textEditor_20250429: _ai_sdk_provider_utils.
|
|
563
|
+
textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
554
564
|
command: "view" | "create" | "str_replace" | "insert";
|
|
555
565
|
path: string;
|
|
556
566
|
file_text?: string;
|
|
@@ -559,7 +569,7 @@ declare const anthropicTools: {
|
|
|
559
569
|
insert_text?: string;
|
|
560
570
|
old_str?: string;
|
|
561
571
|
view_range?: number[];
|
|
562
|
-
}, {}>;
|
|
572
|
+
}, {}, {}>;
|
|
563
573
|
/**
|
|
564
574
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
565
575
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
@@ -571,7 +581,7 @@ declare const anthropicTools: {
|
|
|
571
581
|
*
|
|
572
582
|
* @param maxCharacters - Optional maximum number of characters to view in the file
|
|
573
583
|
*/
|
|
574
|
-
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.
|
|
584
|
+
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
575
585
|
command: "view" | "create" | "str_replace" | "insert";
|
|
576
586
|
path: string;
|
|
577
587
|
file_text?: string;
|
|
@@ -582,7 +592,7 @@ declare const anthropicTools: {
|
|
|
582
592
|
view_range?: number[];
|
|
583
593
|
}, {
|
|
584
594
|
maxCharacters?: number;
|
|
585
|
-
}>>[0]) => _ai_sdk_provider_utils.
|
|
595
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderDefinedTool<{
|
|
586
596
|
command: "view" | "create" | "str_replace" | "insert";
|
|
587
597
|
path: string;
|
|
588
598
|
file_text?: string;
|
|
@@ -591,7 +601,7 @@ declare const anthropicTools: {
|
|
|
591
601
|
insert_text?: string;
|
|
592
602
|
old_str?: string;
|
|
593
603
|
view_range?: number[];
|
|
594
|
-
}, unknown>;
|
|
604
|
+
}, unknown, {}>;
|
|
595
605
|
/**
|
|
596
606
|
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
597
607
|
*
|
|
@@ -601,7 +611,7 @@ declare const anthropicTools: {
|
|
|
601
611
|
* @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
|
|
602
612
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
603
613
|
*/
|
|
604
|
-
webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.
|
|
614
|
+
webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
605
615
|
url: string;
|
|
606
616
|
}, {
|
|
607
617
|
type: "web_fetch_result";
|
|
@@ -631,7 +641,7 @@ declare const anthropicTools: {
|
|
|
631
641
|
enabled: boolean;
|
|
632
642
|
};
|
|
633
643
|
maxContentTokens?: number;
|
|
634
|
-
}>>[0]) => _ai_sdk_provider_utils.
|
|
644
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
635
645
|
url: string;
|
|
636
646
|
}, {
|
|
637
647
|
type: "web_fetch_result";
|
|
@@ -653,7 +663,7 @@ declare const anthropicTools: {
|
|
|
653
663
|
};
|
|
654
664
|
};
|
|
655
665
|
retrievedAt: string | null;
|
|
656
|
-
}>;
|
|
666
|
+
}, {}>;
|
|
657
667
|
/**
|
|
658
668
|
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
659
669
|
*
|
|
@@ -663,7 +673,7 @@ declare const anthropicTools: {
|
|
|
663
673
|
* @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
|
|
664
674
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
665
675
|
*/
|
|
666
|
-
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.
|
|
676
|
+
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
667
677
|
url: string;
|
|
668
678
|
}, {
|
|
669
679
|
type: "web_fetch_result";
|
|
@@ -693,7 +703,7 @@ declare const anthropicTools: {
|
|
|
693
703
|
enabled: boolean;
|
|
694
704
|
};
|
|
695
705
|
maxContentTokens?: number;
|
|
696
|
-
}>>[0]) => _ai_sdk_provider_utils.
|
|
706
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
697
707
|
url: string;
|
|
698
708
|
}, {
|
|
699
709
|
type: "web_fetch_result";
|
|
@@ -715,7 +725,79 @@ declare const anthropicTools: {
|
|
|
715
725
|
};
|
|
716
726
|
};
|
|
717
727
|
retrievedAt: string | null;
|
|
718
|
-
}>;
|
|
728
|
+
}, {}>;
|
|
729
|
+
/**
|
|
730
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
731
|
+
* GA version (no beta header required). Includes caller restrictions, cache control,
|
|
732
|
+
* deferred loading, and strict mode.
|
|
733
|
+
*
|
|
734
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
735
|
+
* @param allowedDomains - Only fetch from these domains
|
|
736
|
+
* @param blockedDomains - Never fetch from these domains
|
|
737
|
+
* @param citations - Citations configuration for fetched documents
|
|
738
|
+
* @param maxContentTokens - Max content tokens included in context
|
|
739
|
+
* @param allowedCallers - Restrict callers (e.g. ["direct"] to prevent code_execution usage)
|
|
740
|
+
* @param useCache - Whether to use cached content (set false for fresh content)
|
|
741
|
+
* @param deferLoading - Defer loading until tool_search discovers it
|
|
742
|
+
* @param strict - Enable strict schema validation
|
|
743
|
+
*/
|
|
744
|
+
webFetch_20260309: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
|
|
745
|
+
url: string;
|
|
746
|
+
}, {
|
|
747
|
+
type: "web_fetch_result";
|
|
748
|
+
url: string;
|
|
749
|
+
content: {
|
|
750
|
+
type: "document";
|
|
751
|
+
title: string | null;
|
|
752
|
+
citations?: {
|
|
753
|
+
enabled: boolean;
|
|
754
|
+
};
|
|
755
|
+
source: {
|
|
756
|
+
type: "base64";
|
|
757
|
+
mediaType: "application/pdf";
|
|
758
|
+
data: string;
|
|
759
|
+
} | {
|
|
760
|
+
type: "text";
|
|
761
|
+
mediaType: "text/plain";
|
|
762
|
+
data: string;
|
|
763
|
+
};
|
|
764
|
+
};
|
|
765
|
+
retrievedAt: string | null;
|
|
766
|
+
}, {
|
|
767
|
+
maxUses?: number;
|
|
768
|
+
allowedDomains?: string[];
|
|
769
|
+
blockedDomains?: string[];
|
|
770
|
+
citations?: {
|
|
771
|
+
enabled: boolean;
|
|
772
|
+
};
|
|
773
|
+
maxContentTokens?: number;
|
|
774
|
+
allowedCallers?: Array<"direct" | "code_execution_20250825" | "code_execution_20260120">;
|
|
775
|
+
useCache?: boolean;
|
|
776
|
+
deferLoading?: boolean;
|
|
777
|
+
strict?: boolean;
|
|
778
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderDefinedTool<{
|
|
779
|
+
url: string;
|
|
780
|
+
}, {
|
|
781
|
+
type: "web_fetch_result";
|
|
782
|
+
url: string;
|
|
783
|
+
content: {
|
|
784
|
+
type: "document";
|
|
785
|
+
title: string | null;
|
|
786
|
+
citations?: {
|
|
787
|
+
enabled: boolean;
|
|
788
|
+
};
|
|
789
|
+
source: {
|
|
790
|
+
type: "base64";
|
|
791
|
+
mediaType: "application/pdf";
|
|
792
|
+
data: string;
|
|
793
|
+
} | {
|
|
794
|
+
type: "text";
|
|
795
|
+
mediaType: "text/plain";
|
|
796
|
+
data: string;
|
|
797
|
+
};
|
|
798
|
+
};
|
|
799
|
+
retrievedAt: string | null;
|
|
800
|
+
}, {}>;
|
|
719
801
|
/**
|
|
720
802
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
721
803
|
*
|
|
@@ -724,7 +806,7 @@ declare const anthropicTools: {
|
|
|
724
806
|
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
725
807
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
726
808
|
*/
|
|
727
|
-
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.
|
|
809
|
+
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
728
810
|
query: string;
|
|
729
811
|
}, {
|
|
730
812
|
type: "web_search_result";
|
|
@@ -743,7 +825,7 @@ declare const anthropicTools: {
|
|
|
743
825
|
country?: string;
|
|
744
826
|
timezone?: string;
|
|
745
827
|
};
|
|
746
|
-
}>>[0]) => _ai_sdk_provider_utils.
|
|
828
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
747
829
|
query: string;
|
|
748
830
|
}, {
|
|
749
831
|
type: "web_search_result";
|
|
@@ -751,7 +833,7 @@ declare const anthropicTools: {
|
|
|
751
833
|
title: string | null;
|
|
752
834
|
pageAge: string | null;
|
|
753
835
|
encryptedContent: string;
|
|
754
|
-
}[]>;
|
|
836
|
+
}[], {}>;
|
|
755
837
|
/**
|
|
756
838
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
757
839
|
*
|
|
@@ -760,7 +842,7 @@ declare const anthropicTools: {
|
|
|
760
842
|
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
761
843
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
762
844
|
*/
|
|
763
|
-
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.
|
|
845
|
+
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
764
846
|
query: string;
|
|
765
847
|
}, {
|
|
766
848
|
type: "web_search_result";
|
|
@@ -779,7 +861,8 @@ declare const anthropicTools: {
|
|
|
779
861
|
country?: string;
|
|
780
862
|
timezone?: string;
|
|
781
863
|
};
|
|
782
|
-
|
|
864
|
+
allowedCallers?: Array<"direct" | "code_execution_20250825" | "code_execution_20260120">;
|
|
865
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
783
866
|
query: string;
|
|
784
867
|
}, {
|
|
785
868
|
type: "web_search_result";
|
|
@@ -787,7 +870,7 @@ declare const anthropicTools: {
|
|
|
787
870
|
title: string | null;
|
|
788
871
|
pageAge: string | null;
|
|
789
872
|
encryptedContent: string;
|
|
790
|
-
}[]>;
|
|
873
|
+
}[], {}>;
|
|
791
874
|
/**
|
|
792
875
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
793
876
|
*
|
|
@@ -801,19 +884,19 @@ declare const anthropicTools: {
|
|
|
801
884
|
*
|
|
802
885
|
* Supported models: Claude Opus 4.5, Claude Sonnet 4.5
|
|
803
886
|
*/
|
|
804
|
-
toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.
|
|
887
|
+
toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
805
888
|
pattern: string;
|
|
806
889
|
limit?: number;
|
|
807
890
|
}, {
|
|
808
891
|
type: "tool_reference";
|
|
809
892
|
toolName: string;
|
|
810
|
-
}[], {}>>[0]) => _ai_sdk_provider_utils.
|
|
893
|
+
}[], {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
811
894
|
pattern: string;
|
|
812
895
|
limit?: number;
|
|
813
896
|
}, {
|
|
814
897
|
type: "tool_reference";
|
|
815
898
|
toolName: string;
|
|
816
|
-
}[]>;
|
|
899
|
+
}[], {}>;
|
|
817
900
|
/**
|
|
818
901
|
* Creates a tool search tool that uses BM25 (natural language) to find tools.
|
|
819
902
|
*
|
|
@@ -827,19 +910,19 @@ declare const anthropicTools: {
|
|
|
827
910
|
*
|
|
828
911
|
* Supported models: Claude Opus 4.5, Claude Sonnet 4.5
|
|
829
912
|
*/
|
|
830
|
-
toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.
|
|
913
|
+
toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
831
914
|
query: string;
|
|
832
915
|
limit?: number;
|
|
833
916
|
}, {
|
|
834
917
|
type: "tool_reference";
|
|
835
918
|
toolName: string;
|
|
836
|
-
}[], {}>>[0]) => _ai_sdk_provider_utils.
|
|
919
|
+
}[], {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
837
920
|
query: string;
|
|
838
921
|
limit?: number;
|
|
839
922
|
}, {
|
|
840
923
|
type: "tool_reference";
|
|
841
924
|
toolName: string;
|
|
842
|
-
}[]>;
|
|
925
|
+
}[], {}>;
|
|
843
926
|
};
|
|
844
927
|
|
|
845
928
|
type AnthropicCacheControl = {
|
|
@@ -873,9 +956,11 @@ type AnthropicTool = {
|
|
|
873
956
|
} | {
|
|
874
957
|
type: 'code_execution_20250825';
|
|
875
958
|
name: string;
|
|
959
|
+
cache_control?: AnthropicCacheControl | undefined;
|
|
876
960
|
} | {
|
|
877
961
|
type: 'code_execution_20260120';
|
|
878
962
|
name: string;
|
|
963
|
+
cache_control?: AnthropicCacheControl | undefined;
|
|
879
964
|
} | {
|
|
880
965
|
name: string;
|
|
881
966
|
type: 'computer_20250124' | 'computer_20241022';
|
|
@@ -907,6 +992,7 @@ type AnthropicTool = {
|
|
|
907
992
|
} | {
|
|
908
993
|
name: string;
|
|
909
994
|
type: 'memory_20250818';
|
|
995
|
+
cache_control?: AnthropicCacheControl | undefined;
|
|
910
996
|
} | {
|
|
911
997
|
type: 'web_fetch_20250910' | 'web_fetch_20260209';
|
|
912
998
|
name: string;
|
|
@@ -918,6 +1004,21 @@ type AnthropicTool = {
|
|
|
918
1004
|
};
|
|
919
1005
|
max_content_tokens?: number;
|
|
920
1006
|
cache_control: AnthropicCacheControl | undefined;
|
|
1007
|
+
} | {
|
|
1008
|
+
type: 'web_fetch_20260309';
|
|
1009
|
+
name: string;
|
|
1010
|
+
max_uses?: number;
|
|
1011
|
+
allowed_domains?: string[];
|
|
1012
|
+
blocked_domains?: string[];
|
|
1013
|
+
citations?: {
|
|
1014
|
+
enabled: boolean;
|
|
1015
|
+
};
|
|
1016
|
+
max_content_tokens?: number;
|
|
1017
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
1018
|
+
use_cache?: boolean;
|
|
1019
|
+
defer_loading?: boolean;
|
|
1020
|
+
strict?: boolean;
|
|
1021
|
+
cache_control: AnthropicCacheControl | undefined;
|
|
921
1022
|
} | {
|
|
922
1023
|
type: 'web_search_20250305' | 'web_search_20260209';
|
|
923
1024
|
name: string;
|
|
@@ -931,13 +1032,16 @@ type AnthropicTool = {
|
|
|
931
1032
|
country?: string;
|
|
932
1033
|
timezone?: string;
|
|
933
1034
|
};
|
|
1035
|
+
allowed_callers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
934
1036
|
cache_control: AnthropicCacheControl | undefined;
|
|
935
1037
|
} | {
|
|
936
1038
|
type: 'tool_search_tool_regex_20251119';
|
|
937
1039
|
name: string;
|
|
1040
|
+
cache_control?: AnthropicCacheControl | undefined;
|
|
938
1041
|
} | {
|
|
939
1042
|
type: 'tool_search_tool_bm25_20251119';
|
|
940
1043
|
name: string;
|
|
1044
|
+
cache_control?: AnthropicCacheControl | undefined;
|
|
941
1045
|
};
|
|
942
1046
|
type AnthropicToolChoice = {
|
|
943
1047
|
type: 'auto' | 'any';
|
|
@@ -958,7 +1062,7 @@ declare class CacheControlValidator {
|
|
|
958
1062
|
getWarnings(): SharedV4Warning[];
|
|
959
1063
|
}
|
|
960
1064
|
|
|
961
|
-
declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, supportsStrictTools, }: {
|
|
1065
|
+
declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, supportsStrictTools, defaultEagerInputStreaming, }: {
|
|
962
1066
|
tools: LanguageModelV4CallOptions['tools'];
|
|
963
1067
|
toolChoice: LanguageModelV4CallOptions['toolChoice'] | undefined;
|
|
964
1068
|
disableParallelToolUse?: boolean;
|
|
@@ -971,6 +1075,11 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
|
|
|
971
1075
|
* Whether the model supports strict mode on tool definitions.
|
|
972
1076
|
*/
|
|
973
1077
|
supportsStrictTools: boolean;
|
|
1078
|
+
/**
|
|
1079
|
+
* Default for `eager_input_streaming` on function tools that do not set
|
|
1080
|
+
* it explicitly. Driven by the model-level `toolStreaming` option.
|
|
1081
|
+
*/
|
|
1082
|
+
defaultEagerInputStreaming?: boolean;
|
|
974
1083
|
}): Promise<{
|
|
975
1084
|
tools: Array<AnthropicTool> | undefined;
|
|
976
1085
|
toolChoice: AnthropicToolChoice | undefined;
|
|
@@ -978,4 +1087,4 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
|
|
|
978
1087
|
betas: Set<string>;
|
|
979
1088
|
}>;
|
|
980
1089
|
|
|
981
|
-
export { AnthropicMessagesLanguageModel, type AnthropicMessagesModelId, anthropicTools, getModelCapabilities, prepareTools };
|
|
1090
|
+
export { AnthropicLanguageModel, AnthropicLanguageModel as AnthropicMessagesLanguageModel, type AnthropicModelId as AnthropicMessagesModelId, type AnthropicModelId, anthropicTools, getModelCapabilities, prepareTools };
|