@ai-sdk/anthropic 4.0.0-beta.5 → 4.0.0-beta.67
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 +500 -4
- package/README.md +2 -0
- package/dist/index.d.ts +265 -68
- package/dist/index.js +2636 -1427
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +234 -62
- package/dist/internal/index.js +2605 -1413
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +303 -20
- package/package.json +16 -17
- package/src/{anthropic-messages-api.ts → anthropic-api.ts} +158 -17
- 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} +104 -11
- package/src/{anthropic-messages-language-model.ts → anthropic-language-model.ts} +494 -96
- package/src/anthropic-message-metadata.ts +69 -9
- package/src/anthropic-prepare-tools.ts +31 -7
- package/src/anthropic-provider.ts +42 -13
- package/src/anthropic-tools.ts +31 -0
- package/src/convert-anthropic-usage.ts +109 -0
- package/src/{convert-to-anthropic-messages-prompt.ts → convert-to-anthropic-prompt.ts} +376 -198
- 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 +13 -2
- 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/advisor_20260301.ts +128 -0
- package/src/tool/bash_20241022.ts +84 -13
- package/src/tool/bash_20250124.ts +84 -13
- 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-search_20250305.ts +2 -2
- package/src/tool/web-search_20260209.ts +2 -2
- package/dist/index.d.mts +0 -1090
- package/dist/index.mjs +0 -5244
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -969
- package/dist/internal/index.mjs +0 -5136
- package/dist/internal/index.mjs.map +0 -1
- package/src/convert-anthropic-messages-usage.ts +0 -73
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
import { LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, JSONSchema7, SharedV4ProviderMetadata, SharedV4Warning } from '@ai-sdk/provider';
|
|
1
|
+
import { FilesV4, FilesV4UploadFileCallOptions, FilesV4UploadFileResult, LanguageModelV4, JSONObject, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult, JSONSchema7, SharedV4ProviderMetadata, SharedV4Warning, SkillsV4 } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
-
import { Resolvable,
|
|
3
|
+
import { FetchFunction, WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, Resolvable, ToolExecuteFunction, Tool, Experimental_SandboxSession, ProviderDefinedTool } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface AnthropicFilesConfig {
|
|
6
|
+
provider: string;
|
|
7
|
+
baseURL: string;
|
|
8
|
+
headers: () => Record<string, string | undefined>;
|
|
9
|
+
fetch?: FetchFunction;
|
|
10
|
+
}
|
|
11
|
+
declare class AnthropicFiles implements FilesV4 {
|
|
12
|
+
private readonly config;
|
|
13
|
+
readonly specificationVersion = "v4";
|
|
14
|
+
get provider(): string;
|
|
15
|
+
constructor(config: AnthropicFilesConfig);
|
|
16
|
+
uploadFile({ data, mediaType, filename, }: FilesV4UploadFileCallOptions): Promise<FilesV4UploadFileResult>;
|
|
17
|
+
}
|
|
6
18
|
|
|
7
|
-
type
|
|
19
|
+
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' | 'claude-opus-4-8' | 'claude-fable-5' | (string & {});
|
|
20
|
+
|
|
21
|
+
type AnthropicLanguageModelConfig = {
|
|
8
22
|
provider: string;
|
|
9
23
|
baseURL: string;
|
|
10
|
-
headers
|
|
24
|
+
headers?: Resolvable<Record<string, string | undefined>>;
|
|
11
25
|
fetch?: FetchFunction;
|
|
12
26
|
buildRequestUrl?: (baseURL: string, isStreaming: boolean) => string;
|
|
13
27
|
transformRequestBody?: (args: Record<string, any>, betas: Set<string>) => Record<string, any>;
|
|
@@ -23,12 +37,20 @@ type AnthropicMessagesConfig = {
|
|
|
23
37
|
*/
|
|
24
38
|
supportsStrictTools?: boolean;
|
|
25
39
|
};
|
|
26
|
-
declare class
|
|
40
|
+
declare class AnthropicLanguageModel implements LanguageModelV4 {
|
|
27
41
|
readonly specificationVersion = "v4";
|
|
28
|
-
readonly modelId:
|
|
42
|
+
readonly modelId: AnthropicModelId;
|
|
29
43
|
private readonly config;
|
|
30
44
|
private readonly generateId;
|
|
31
|
-
|
|
45
|
+
static [WORKFLOW_SERIALIZE](model: AnthropicLanguageModel): {
|
|
46
|
+
modelId: string;
|
|
47
|
+
config: JSONObject;
|
|
48
|
+
};
|
|
49
|
+
static [WORKFLOW_DESERIALIZE](options: {
|
|
50
|
+
modelId: AnthropicModelId;
|
|
51
|
+
config: AnthropicLanguageModelConfig;
|
|
52
|
+
}): AnthropicLanguageModel;
|
|
53
|
+
constructor(modelId: AnthropicModelId, config: AnthropicLanguageModelConfig);
|
|
32
54
|
supportsUrl(url: URL): boolean;
|
|
33
55
|
get provider(): string;
|
|
34
56
|
/**
|
|
@@ -46,28 +68,148 @@ declare class AnthropicMessagesLanguageModel implements LanguageModelV4 {
|
|
|
46
68
|
doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
|
|
47
69
|
doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
|
|
48
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Returns the capabilities of a Claude model that are used for defaults and feature selection.
|
|
73
|
+
*
|
|
74
|
+
* @see https://docs.claude.com/en/docs/about-claude/models/overview#model-comparison-table
|
|
75
|
+
* @see https://platform.claude.com/docs/en/build-with-claude/structured-outputs
|
|
76
|
+
*/
|
|
77
|
+
declare function getModelCapabilities(modelId: string): {
|
|
78
|
+
maxOutputTokens: number;
|
|
79
|
+
supportsStructuredOutput: boolean;
|
|
80
|
+
supportsAdaptiveThinking: boolean;
|
|
81
|
+
rejectsSamplingParameters: boolean;
|
|
82
|
+
supportsXhighEffort: boolean;
|
|
83
|
+
isKnownModel: boolean;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
type Bash20241022Input = {
|
|
87
|
+
/**
|
|
88
|
+
* The bash command to run. Required unless the tool is being restarted.
|
|
89
|
+
*/
|
|
90
|
+
command: string;
|
|
91
|
+
/**
|
|
92
|
+
* Specifying true will restart this tool. Otherwise, leave this unspecified.
|
|
93
|
+
*/
|
|
94
|
+
restart?: boolean;
|
|
95
|
+
};
|
|
96
|
+
type Bash20241022Options<OUTPUT> = {
|
|
97
|
+
execute?: ToolExecuteFunction<Bash20241022Input, OUTPUT, {}>;
|
|
98
|
+
needsApproval?: Tool<Bash20241022Input, OUTPUT, {}>['needsApproval'];
|
|
99
|
+
toModelOutput?: Tool<Bash20241022Input, OUTPUT, {}>['toModelOutput'];
|
|
100
|
+
onInputStart?: Tool<Bash20241022Input, OUTPUT, {}>['onInputStart'];
|
|
101
|
+
onInputDelta?: Tool<Bash20241022Input, OUTPUT, {}>['onInputDelta'];
|
|
102
|
+
onInputAvailable?: Tool<Bash20241022Input, OUTPUT, {}>['onInputAvailable'];
|
|
103
|
+
};
|
|
104
|
+
type Bash20241022DefaultOutput = Awaited<ReturnType<Experimental_SandboxSession['run']>>;
|
|
105
|
+
declare function bash_20241022(options?: Omit<Bash20241022Options<Bash20241022DefaultOutput>, 'execute'> & {
|
|
106
|
+
execute?: undefined;
|
|
107
|
+
}): ProviderDefinedTool<Bash20241022Input, Bash20241022DefaultOutput, {}>;
|
|
108
|
+
declare function bash_20241022<OUTPUT = never>(options: Omit<Bash20241022Options<OUTPUT>, 'execute'> & {
|
|
109
|
+
execute: null;
|
|
110
|
+
}): ProviderDefinedTool<Bash20241022Input, OUTPUT, {}>;
|
|
111
|
+
declare function bash_20241022<OUTPUT>(options: Omit<Bash20241022Options<OUTPUT>, 'execute'> & {
|
|
112
|
+
execute: Bash20241022Options<OUTPUT>['execute'];
|
|
113
|
+
}): ProviderDefinedTool<Bash20241022Input, OUTPUT, {}>;
|
|
114
|
+
|
|
115
|
+
type Bash20250124Input = {
|
|
116
|
+
/**
|
|
117
|
+
* The bash command to run. Required unless the tool is being restarted.
|
|
118
|
+
*/
|
|
119
|
+
command: string;
|
|
120
|
+
/**
|
|
121
|
+
* Specifying true will restart this tool. Otherwise, leave this unspecified.
|
|
122
|
+
*/
|
|
123
|
+
restart?: boolean;
|
|
124
|
+
};
|
|
125
|
+
type Bash20250124Options<OUTPUT> = {
|
|
126
|
+
execute?: ToolExecuteFunction<Bash20250124Input, OUTPUT, {}>;
|
|
127
|
+
needsApproval?: Tool<Bash20250124Input, OUTPUT, {}>['needsApproval'];
|
|
128
|
+
toModelOutput?: Tool<Bash20250124Input, OUTPUT, {}>['toModelOutput'];
|
|
129
|
+
onInputStart?: Tool<Bash20250124Input, OUTPUT, {}>['onInputStart'];
|
|
130
|
+
onInputDelta?: Tool<Bash20250124Input, OUTPUT, {}>['onInputDelta'];
|
|
131
|
+
onInputAvailable?: Tool<Bash20250124Input, OUTPUT, {}>['onInputAvailable'];
|
|
132
|
+
};
|
|
133
|
+
type Bash20250124DefaultOutput = Awaited<ReturnType<Experimental_SandboxSession['run']>>;
|
|
134
|
+
declare function bash_20250124(options?: Omit<Bash20250124Options<Bash20250124DefaultOutput>, 'execute'> & {
|
|
135
|
+
execute?: undefined;
|
|
136
|
+
}): ProviderDefinedTool<Bash20250124Input, Bash20250124DefaultOutput, {}>;
|
|
137
|
+
declare function bash_20250124<OUTPUT = never>(options: Omit<Bash20250124Options<OUTPUT>, 'execute'> & {
|
|
138
|
+
execute: null;
|
|
139
|
+
}): ProviderDefinedTool<Bash20250124Input, OUTPUT, {}>;
|
|
140
|
+
declare function bash_20250124<OUTPUT>(options: Omit<Bash20250124Options<OUTPUT>, 'execute'> & {
|
|
141
|
+
execute: Bash20250124Options<OUTPUT>['execute'];
|
|
142
|
+
}): ProviderDefinedTool<Bash20250124Input, OUTPUT, {}>;
|
|
49
143
|
|
|
50
144
|
declare const anthropicTools: {
|
|
145
|
+
/**
|
|
146
|
+
* Pairs a faster executor model with a higher-intelligence advisor model
|
|
147
|
+
* that provides strategic guidance mid-generation.
|
|
148
|
+
*
|
|
149
|
+
* The advisor lets a faster, lower-cost executor model consult a
|
|
150
|
+
* higher-intelligence advisor model server-side. The advisor reads the
|
|
151
|
+
* executor's full transcript and produces a plan or course correction;
|
|
152
|
+
* the executor continues with the task, informed by the advice. All of
|
|
153
|
+
* this happens inside a single `/v1/messages` request.
|
|
154
|
+
*
|
|
155
|
+
* Beta header `advisor-tool-2026-03-01` is added automatically when this
|
|
156
|
+
* tool is included.
|
|
157
|
+
*
|
|
158
|
+
* Multi-turn conversations: pass the full assistant content (including
|
|
159
|
+
* `advisor_tool_result` blocks) back to the API on subsequent turns. If
|
|
160
|
+
* you omit the advisor tool from `tools` on a follow-up turn while the
|
|
161
|
+
* message history still contains `advisor_tool_result` blocks, the API
|
|
162
|
+
* returns a `400 invalid_request_error`.
|
|
163
|
+
*
|
|
164
|
+
* Supported executor models: Claude Haiku 4.5, Sonnet 4.6, Opus 4.6,
|
|
165
|
+
* Opus 4.7. The advisor must be at least as capable as the executor.
|
|
166
|
+
*
|
|
167
|
+
* @param model - The advisor model ID (required), e.g. `"claude-opus-4-8"`.
|
|
168
|
+
* @param maxUses - Maximum advisor calls per request (per-request cap).
|
|
169
|
+
* @param caching - Enables prompt caching for the advisor's transcript
|
|
170
|
+
* across calls within a conversation. Worthwhile from ~3 advisor calls
|
|
171
|
+
* per conversation.
|
|
172
|
+
*/
|
|
173
|
+
advisor_20260301: (args: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {
|
|
174
|
+
type: "advisor_result";
|
|
175
|
+
text: string;
|
|
176
|
+
} | {
|
|
177
|
+
type: "advisor_redacted_result";
|
|
178
|
+
encryptedContent: string;
|
|
179
|
+
} | {
|
|
180
|
+
type: "advisor_tool_result_error";
|
|
181
|
+
errorCode: string;
|
|
182
|
+
}, {
|
|
183
|
+
model: string;
|
|
184
|
+
maxUses?: number;
|
|
185
|
+
caching?: {
|
|
186
|
+
type: "ephemeral";
|
|
187
|
+
ttl: "5m" | "1h";
|
|
188
|
+
};
|
|
189
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{}, {
|
|
190
|
+
type: "advisor_result";
|
|
191
|
+
text: string;
|
|
192
|
+
} | {
|
|
193
|
+
type: "advisor_redacted_result";
|
|
194
|
+
encryptedContent: string;
|
|
195
|
+
} | {
|
|
196
|
+
type: "advisor_tool_result_error";
|
|
197
|
+
errorCode: string;
|
|
198
|
+
}, {}>;
|
|
51
199
|
/**
|
|
52
200
|
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
53
201
|
* allowing system operations, script execution, and command-line automation.
|
|
54
202
|
*
|
|
55
203
|
* Image results are supported.
|
|
56
204
|
*/
|
|
57
|
-
bash_20241022:
|
|
58
|
-
command: string;
|
|
59
|
-
restart?: boolean;
|
|
60
|
-
}, {}>;
|
|
205
|
+
bash_20241022: typeof bash_20241022;
|
|
61
206
|
/**
|
|
62
207
|
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
63
208
|
* allowing system operations, script execution, and command-line automation.
|
|
64
209
|
*
|
|
65
210
|
* Image results are supported.
|
|
66
211
|
*/
|
|
67
|
-
bash_20250124:
|
|
68
|
-
command: string;
|
|
69
|
-
restart?: boolean;
|
|
70
|
-
}, {}>;
|
|
212
|
+
bash_20250124: typeof bash_20250124;
|
|
71
213
|
/**
|
|
72
214
|
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
73
215
|
* run system commands, create and edit files, and process uploaded files directly within
|
|
@@ -76,7 +218,7 @@ declare const anthropicTools: {
|
|
|
76
218
|
* The code execution tool allows Claude to run Bash commands and manipulate files,
|
|
77
219
|
* including writing code, in a secure, sandboxed environment.
|
|
78
220
|
*/
|
|
79
|
-
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.
|
|
221
|
+
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
80
222
|
code: string;
|
|
81
223
|
}, {
|
|
82
224
|
type: "code_execution_result";
|
|
@@ -87,7 +229,7 @@ declare const anthropicTools: {
|
|
|
87
229
|
type: "code_execution_output";
|
|
88
230
|
file_id: string;
|
|
89
231
|
}>;
|
|
90
|
-
}, {}>>[0]) => _ai_sdk_provider_utils.
|
|
232
|
+
}, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
91
233
|
code: string;
|
|
92
234
|
}, {
|
|
93
235
|
type: "code_execution_result";
|
|
@@ -98,7 +240,7 @@ declare const anthropicTools: {
|
|
|
98
240
|
type: "code_execution_output";
|
|
99
241
|
file_id: string;
|
|
100
242
|
}>;
|
|
101
|
-
}>;
|
|
243
|
+
}, {}>;
|
|
102
244
|
/**
|
|
103
245
|
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
104
246
|
* run system commands, create and edit files, and process uploaded files directly within
|
|
@@ -109,7 +251,7 @@ declare const anthropicTools: {
|
|
|
109
251
|
*
|
|
110
252
|
* This is the latest version with enhanced Bash support and file operations.
|
|
111
253
|
*/
|
|
112
|
-
codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.
|
|
254
|
+
codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
113
255
|
type: "programmatic-tool-call";
|
|
114
256
|
code: string;
|
|
115
257
|
} | {
|
|
@@ -171,7 +313,7 @@ declare const anthropicTools: {
|
|
|
171
313
|
new_start: number | null;
|
|
172
314
|
old_lines: number | null;
|
|
173
315
|
old_start: number | null;
|
|
174
|
-
}, {}>>[0]) => _ai_sdk_provider_utils.
|
|
316
|
+
}, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
175
317
|
type: "programmatic-tool-call";
|
|
176
318
|
code: string;
|
|
177
319
|
} | {
|
|
@@ -233,7 +375,7 @@ declare const anthropicTools: {
|
|
|
233
375
|
new_start: number | null;
|
|
234
376
|
old_lines: number | null;
|
|
235
377
|
old_start: number | null;
|
|
236
|
-
}>;
|
|
378
|
+
}, {}>;
|
|
237
379
|
/**
|
|
238
380
|
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
239
381
|
* run system commands, create and edit files, and process uploaded files directly within
|
|
@@ -246,7 +388,7 @@ declare const anthropicTools: {
|
|
|
246
388
|
*
|
|
247
389
|
* Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
|
|
248
390
|
*/
|
|
249
|
-
codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.
|
|
391
|
+
codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
250
392
|
type: "programmatic-tool-call";
|
|
251
393
|
code: string;
|
|
252
394
|
} | {
|
|
@@ -317,7 +459,7 @@ declare const anthropicTools: {
|
|
|
317
459
|
new_start: number | null;
|
|
318
460
|
old_lines: number | null;
|
|
319
461
|
old_start: number | null;
|
|
320
|
-
}, {}>>[0]) => _ai_sdk_provider_utils.
|
|
462
|
+
}, {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
321
463
|
type: "programmatic-tool-call";
|
|
322
464
|
code: string;
|
|
323
465
|
} | {
|
|
@@ -388,7 +530,7 @@ declare const anthropicTools: {
|
|
|
388
530
|
new_start: number | null;
|
|
389
531
|
old_lines: number | null;
|
|
390
532
|
old_start: number | null;
|
|
391
|
-
}>;
|
|
533
|
+
}, {}>;
|
|
392
534
|
/**
|
|
393
535
|
* Claude can interact with computer environments through the computer use tool, which
|
|
394
536
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -399,7 +541,7 @@ declare const anthropicTools: {
|
|
|
399
541
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
400
542
|
* @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.
|
|
401
543
|
*/
|
|
402
|
-
computer_20241022: _ai_sdk_provider_utils.
|
|
544
|
+
computer_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
403
545
|
action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
|
|
404
546
|
coordinate?: number[];
|
|
405
547
|
text?: string;
|
|
@@ -407,7 +549,7 @@ declare const anthropicTools: {
|
|
|
407
549
|
displayWidthPx: number;
|
|
408
550
|
displayHeightPx: number;
|
|
409
551
|
displayNumber?: number;
|
|
410
|
-
}>;
|
|
552
|
+
}, {}>;
|
|
411
553
|
/**
|
|
412
554
|
* Claude can interact with computer environments through the computer use tool, which
|
|
413
555
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -418,7 +560,7 @@ declare const anthropicTools: {
|
|
|
418
560
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
419
561
|
* @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.
|
|
420
562
|
*/
|
|
421
|
-
computer_20250124: _ai_sdk_provider_utils.
|
|
563
|
+
computer_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
422
564
|
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";
|
|
423
565
|
coordinate?: [number, number];
|
|
424
566
|
duration?: number;
|
|
@@ -430,7 +572,7 @@ declare const anthropicTools: {
|
|
|
430
572
|
displayWidthPx: number;
|
|
431
573
|
displayHeightPx: number;
|
|
432
574
|
displayNumber?: number;
|
|
433
|
-
}>;
|
|
575
|
+
}, {}>;
|
|
434
576
|
/**
|
|
435
577
|
* Claude can interact with computer environments through the computer use tool, which
|
|
436
578
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -446,7 +588,7 @@ declare const anthropicTools: {
|
|
|
446
588
|
* @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.
|
|
447
589
|
* @param enableZoom - Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
|
|
448
590
|
*/
|
|
449
|
-
computer_20251124: _ai_sdk_provider_utils.
|
|
591
|
+
computer_20251124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
450
592
|
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";
|
|
451
593
|
coordinate?: [number, number];
|
|
452
594
|
duration?: number;
|
|
@@ -460,7 +602,7 @@ declare const anthropicTools: {
|
|
|
460
602
|
displayHeightPx: number;
|
|
461
603
|
displayNumber?: number;
|
|
462
604
|
enableZoom?: boolean;
|
|
463
|
-
}>;
|
|
605
|
+
}, {}>;
|
|
464
606
|
/**
|
|
465
607
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
466
608
|
* Claude can create, read, update, and delete files that persist between sessions,
|
|
@@ -469,7 +611,7 @@ declare const anthropicTools: {
|
|
|
469
611
|
*
|
|
470
612
|
* Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
|
|
471
613
|
*/
|
|
472
|
-
memory_20250818: _ai_sdk_provider_utils.
|
|
614
|
+
memory_20250818: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
473
615
|
command: "view";
|
|
474
616
|
path: string;
|
|
475
617
|
view_range?: [number, number];
|
|
@@ -494,7 +636,7 @@ declare const anthropicTools: {
|
|
|
494
636
|
command: "rename";
|
|
495
637
|
old_path: string;
|
|
496
638
|
new_path: string;
|
|
497
|
-
}, {}>;
|
|
639
|
+
}, {}, {}>;
|
|
498
640
|
/**
|
|
499
641
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
500
642
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
@@ -502,7 +644,7 @@ declare const anthropicTools: {
|
|
|
502
644
|
*
|
|
503
645
|
* Supported models: Claude Sonnet 3.5
|
|
504
646
|
*/
|
|
505
|
-
textEditor_20241022: _ai_sdk_provider_utils.
|
|
647
|
+
textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
506
648
|
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
507
649
|
path: string;
|
|
508
650
|
file_text?: string;
|
|
@@ -511,7 +653,7 @@ declare const anthropicTools: {
|
|
|
511
653
|
insert_text?: string;
|
|
512
654
|
old_str?: string;
|
|
513
655
|
view_range?: number[];
|
|
514
|
-
}, {}>;
|
|
656
|
+
}, {}, {}>;
|
|
515
657
|
/**
|
|
516
658
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
517
659
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
@@ -519,7 +661,7 @@ declare const anthropicTools: {
|
|
|
519
661
|
*
|
|
520
662
|
* Supported models: Claude Sonnet 3.7
|
|
521
663
|
*/
|
|
522
|
-
textEditor_20250124: _ai_sdk_provider_utils.
|
|
664
|
+
textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
523
665
|
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
524
666
|
path: string;
|
|
525
667
|
file_text?: string;
|
|
@@ -528,7 +670,7 @@ declare const anthropicTools: {
|
|
|
528
670
|
insert_text?: string;
|
|
529
671
|
old_str?: string;
|
|
530
672
|
view_range?: number[];
|
|
531
|
-
}, {}>;
|
|
673
|
+
}, {}, {}>;
|
|
532
674
|
/**
|
|
533
675
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
534
676
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
@@ -538,7 +680,7 @@ declare const anthropicTools: {
|
|
|
538
680
|
*
|
|
539
681
|
* @deprecated Use textEditor_20250728 instead
|
|
540
682
|
*/
|
|
541
|
-
textEditor_20250429: _ai_sdk_provider_utils.
|
|
683
|
+
textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
542
684
|
command: "view" | "create" | "str_replace" | "insert";
|
|
543
685
|
path: string;
|
|
544
686
|
file_text?: string;
|
|
@@ -547,7 +689,7 @@ declare const anthropicTools: {
|
|
|
547
689
|
insert_text?: string;
|
|
548
690
|
old_str?: string;
|
|
549
691
|
view_range?: number[];
|
|
550
|
-
}, {}>;
|
|
692
|
+
}, {}, {}>;
|
|
551
693
|
/**
|
|
552
694
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
553
695
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
@@ -559,7 +701,7 @@ declare const anthropicTools: {
|
|
|
559
701
|
*
|
|
560
702
|
* @param maxCharacters - Optional maximum number of characters to view in the file
|
|
561
703
|
*/
|
|
562
|
-
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.
|
|
704
|
+
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
563
705
|
command: "view" | "create" | "str_replace" | "insert";
|
|
564
706
|
path: string;
|
|
565
707
|
file_text?: string;
|
|
@@ -570,7 +712,7 @@ declare const anthropicTools: {
|
|
|
570
712
|
view_range?: number[];
|
|
571
713
|
}, {
|
|
572
714
|
maxCharacters?: number;
|
|
573
|
-
}>>[0]) => _ai_sdk_provider_utils.
|
|
715
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderDefinedTool<{
|
|
574
716
|
command: "view" | "create" | "str_replace" | "insert";
|
|
575
717
|
path: string;
|
|
576
718
|
file_text?: string;
|
|
@@ -579,7 +721,7 @@ declare const anthropicTools: {
|
|
|
579
721
|
insert_text?: string;
|
|
580
722
|
old_str?: string;
|
|
581
723
|
view_range?: number[];
|
|
582
|
-
}, unknown>;
|
|
724
|
+
}, unknown, {}>;
|
|
583
725
|
/**
|
|
584
726
|
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
585
727
|
*
|
|
@@ -589,7 +731,7 @@ declare const anthropicTools: {
|
|
|
589
731
|
* @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.
|
|
590
732
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
591
733
|
*/
|
|
592
|
-
webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.
|
|
734
|
+
webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
593
735
|
url: string;
|
|
594
736
|
}, {
|
|
595
737
|
type: "web_fetch_result";
|
|
@@ -619,7 +761,7 @@ declare const anthropicTools: {
|
|
|
619
761
|
enabled: boolean;
|
|
620
762
|
};
|
|
621
763
|
maxContentTokens?: number;
|
|
622
|
-
}>>[0]) => _ai_sdk_provider_utils.
|
|
764
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
623
765
|
url: string;
|
|
624
766
|
}, {
|
|
625
767
|
type: "web_fetch_result";
|
|
@@ -641,7 +783,7 @@ declare const anthropicTools: {
|
|
|
641
783
|
};
|
|
642
784
|
};
|
|
643
785
|
retrievedAt: string | null;
|
|
644
|
-
}>;
|
|
786
|
+
}, {}>;
|
|
645
787
|
/**
|
|
646
788
|
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
647
789
|
*
|
|
@@ -651,7 +793,7 @@ declare const anthropicTools: {
|
|
|
651
793
|
* @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.
|
|
652
794
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
653
795
|
*/
|
|
654
|
-
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.
|
|
796
|
+
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
655
797
|
url: string;
|
|
656
798
|
}, {
|
|
657
799
|
type: "web_fetch_result";
|
|
@@ -681,7 +823,7 @@ declare const anthropicTools: {
|
|
|
681
823
|
enabled: boolean;
|
|
682
824
|
};
|
|
683
825
|
maxContentTokens?: number;
|
|
684
|
-
}>>[0]) => _ai_sdk_provider_utils.
|
|
826
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
685
827
|
url: string;
|
|
686
828
|
}, {
|
|
687
829
|
type: "web_fetch_result";
|
|
@@ -703,7 +845,7 @@ declare const anthropicTools: {
|
|
|
703
845
|
};
|
|
704
846
|
};
|
|
705
847
|
retrievedAt: string | null;
|
|
706
|
-
}>;
|
|
848
|
+
}, {}>;
|
|
707
849
|
/**
|
|
708
850
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
709
851
|
*
|
|
@@ -712,7 +854,7 @@ declare const anthropicTools: {
|
|
|
712
854
|
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
713
855
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
714
856
|
*/
|
|
715
|
-
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.
|
|
857
|
+
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
716
858
|
query: string;
|
|
717
859
|
}, {
|
|
718
860
|
type: "web_search_result";
|
|
@@ -731,7 +873,7 @@ declare const anthropicTools: {
|
|
|
731
873
|
country?: string;
|
|
732
874
|
timezone?: string;
|
|
733
875
|
};
|
|
734
|
-
}>>[0]) => _ai_sdk_provider_utils.
|
|
876
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
735
877
|
query: string;
|
|
736
878
|
}, {
|
|
737
879
|
type: "web_search_result";
|
|
@@ -739,7 +881,7 @@ declare const anthropicTools: {
|
|
|
739
881
|
title: string | null;
|
|
740
882
|
pageAge: string | null;
|
|
741
883
|
encryptedContent: string;
|
|
742
|
-
}[]>;
|
|
884
|
+
}[], {}>;
|
|
743
885
|
/**
|
|
744
886
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
745
887
|
*
|
|
@@ -748,7 +890,7 @@ declare const anthropicTools: {
|
|
|
748
890
|
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
749
891
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
750
892
|
*/
|
|
751
|
-
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.
|
|
893
|
+
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
752
894
|
query: string;
|
|
753
895
|
}, {
|
|
754
896
|
type: "web_search_result";
|
|
@@ -767,7 +909,7 @@ declare const anthropicTools: {
|
|
|
767
909
|
country?: string;
|
|
768
910
|
timezone?: string;
|
|
769
911
|
};
|
|
770
|
-
}>>[0]) => _ai_sdk_provider_utils.
|
|
912
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
771
913
|
query: string;
|
|
772
914
|
}, {
|
|
773
915
|
type: "web_search_result";
|
|
@@ -775,7 +917,7 @@ declare const anthropicTools: {
|
|
|
775
917
|
title: string | null;
|
|
776
918
|
pageAge: string | null;
|
|
777
919
|
encryptedContent: string;
|
|
778
|
-
}[]>;
|
|
920
|
+
}[], {}>;
|
|
779
921
|
/**
|
|
780
922
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
781
923
|
*
|
|
@@ -789,19 +931,19 @@ declare const anthropicTools: {
|
|
|
789
931
|
*
|
|
790
932
|
* Supported models: Claude Opus 4.5, Claude Sonnet 4.5
|
|
791
933
|
*/
|
|
792
|
-
toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.
|
|
934
|
+
toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
793
935
|
pattern: string;
|
|
794
936
|
limit?: number;
|
|
795
937
|
}, {
|
|
796
938
|
type: "tool_reference";
|
|
797
939
|
toolName: string;
|
|
798
|
-
}[], {}>>[0]) => _ai_sdk_provider_utils.
|
|
940
|
+
}[], {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
799
941
|
pattern: string;
|
|
800
942
|
limit?: number;
|
|
801
943
|
}, {
|
|
802
944
|
type: "tool_reference";
|
|
803
945
|
toolName: string;
|
|
804
|
-
}[]>;
|
|
946
|
+
}[], {}>;
|
|
805
947
|
/**
|
|
806
948
|
* Creates a tool search tool that uses BM25 (natural language) to find tools.
|
|
807
949
|
*
|
|
@@ -815,19 +957,19 @@ declare const anthropicTools: {
|
|
|
815
957
|
*
|
|
816
958
|
* Supported models: Claude Opus 4.5, Claude Sonnet 4.5
|
|
817
959
|
*/
|
|
818
|
-
toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.
|
|
960
|
+
toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
819
961
|
query: string;
|
|
820
962
|
limit?: number;
|
|
821
963
|
}, {
|
|
822
964
|
type: "tool_reference";
|
|
823
965
|
toolName: string;
|
|
824
|
-
}[], {}>>[0]) => _ai_sdk_provider_utils.
|
|
966
|
+
}[], {}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
825
967
|
query: string;
|
|
826
968
|
limit?: number;
|
|
827
969
|
}, {
|
|
828
970
|
type: "tool_reference";
|
|
829
971
|
toolName: string;
|
|
830
|
-
}[]>;
|
|
972
|
+
}[], {}>;
|
|
831
973
|
};
|
|
832
974
|
|
|
833
975
|
type AnthropicCacheControl = {
|
|
@@ -926,6 +1068,15 @@ type AnthropicTool = {
|
|
|
926
1068
|
} | {
|
|
927
1069
|
type: 'tool_search_tool_bm25_20251119';
|
|
928
1070
|
name: string;
|
|
1071
|
+
} | {
|
|
1072
|
+
type: 'advisor_20260301';
|
|
1073
|
+
name: 'advisor';
|
|
1074
|
+
model: string;
|
|
1075
|
+
max_uses?: number;
|
|
1076
|
+
caching?: {
|
|
1077
|
+
type: 'ephemeral';
|
|
1078
|
+
ttl: '5m' | '1h';
|
|
1079
|
+
};
|
|
929
1080
|
};
|
|
930
1081
|
type AnthropicToolChoice = {
|
|
931
1082
|
type: 'auto' | 'any';
|
|
@@ -946,7 +1097,7 @@ declare class CacheControlValidator {
|
|
|
946
1097
|
getWarnings(): SharedV4Warning[];
|
|
947
1098
|
}
|
|
948
1099
|
|
|
949
|
-
declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, supportsStrictTools, }: {
|
|
1100
|
+
declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cacheControlValidator, supportsStructuredOutput, supportsStrictTools, defaultEagerInputStreaming, }: {
|
|
950
1101
|
tools: LanguageModelV4CallOptions['tools'];
|
|
951
1102
|
toolChoice: LanguageModelV4CallOptions['toolChoice'] | undefined;
|
|
952
1103
|
disableParallelToolUse?: boolean;
|
|
@@ -959,6 +1110,11 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
|
|
|
959
1110
|
* Whether the model supports strict mode on tool definitions.
|
|
960
1111
|
*/
|
|
961
1112
|
supportsStrictTools: boolean;
|
|
1113
|
+
/**
|
|
1114
|
+
* Default for `eager_input_streaming` on function tools that do not set
|
|
1115
|
+
* it explicitly. Driven by the model-level `toolStreaming` option.
|
|
1116
|
+
*/
|
|
1117
|
+
defaultEagerInputStreaming?: boolean;
|
|
962
1118
|
}): Promise<{
|
|
963
1119
|
tools: Array<AnthropicTool> | undefined;
|
|
964
1120
|
toolChoice: AnthropicToolChoice | undefined;
|
|
@@ -966,4 +1122,20 @@ declare function prepareTools({ tools, toolChoice, disableParallelToolUse, cache
|
|
|
966
1122
|
betas: Set<string>;
|
|
967
1123
|
}>;
|
|
968
1124
|
|
|
969
|
-
|
|
1125
|
+
interface AnthropicSkillsConfig {
|
|
1126
|
+
provider: string;
|
|
1127
|
+
baseURL: string;
|
|
1128
|
+
headers: Resolvable<Record<string, string | undefined>>;
|
|
1129
|
+
fetch?: FetchFunction;
|
|
1130
|
+
}
|
|
1131
|
+
declare class AnthropicSkills implements SkillsV4 {
|
|
1132
|
+
private readonly config;
|
|
1133
|
+
readonly specificationVersion = "v4";
|
|
1134
|
+
get provider(): string;
|
|
1135
|
+
constructor(config: AnthropicSkillsConfig);
|
|
1136
|
+
private getHeaders;
|
|
1137
|
+
private fetchVersionMetadata;
|
|
1138
|
+
uploadSkill(params: Parameters<SkillsV4['uploadSkill']>[0]): Promise<Awaited<ReturnType<SkillsV4['uploadSkill']>>>;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
export { AnthropicFiles, AnthropicLanguageModel, AnthropicLanguageModel as AnthropicMessagesLanguageModel, type AnthropicModelId as AnthropicMessagesModelId, type AnthropicModelId, AnthropicSkills, anthropicTools, getModelCapabilities, prepareTools };
|