@fairyhunter13/ai-anthropic 3.0.58-fork.1
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 +2521 -0
- package/LICENSE +13 -0
- package/README.md +43 -0
- package/dist/index.d.mts +1099 -0
- package/dist/index.d.ts +1099 -0
- package/dist/index.js +5222 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +5298 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/index.d.mts +960 -0
- package/dist/internal/index.d.ts +960 -0
- package/dist/internal/index.js +5122 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/internal/index.mjs +5190 -0
- package/dist/internal/index.mjs.map +1 -0
- package/docs/05-anthropic.mdx +1321 -0
- package/internal.d.ts +1 -0
- package/package.json +83 -0
- package/src/anthropic-error.ts +26 -0
- package/src/anthropic-message-metadata.ts +143 -0
- package/src/anthropic-messages-api.ts +1348 -0
- package/src/anthropic-messages-language-model.ts +2407 -0
- package/src/anthropic-messages-options.ts +267 -0
- package/src/anthropic-prepare-tools.ts +404 -0
- package/src/anthropic-provider.ts +177 -0
- package/src/anthropic-tools.ts +238 -0
- package/src/convert-anthropic-messages-usage.ts +73 -0
- package/src/convert-to-anthropic-messages-prompt.ts +1144 -0
- package/src/forward-anthropic-container-id-from-last-step.ts +38 -0
- package/src/get-cache-control.ts +63 -0
- package/src/index.ts +17 -0
- package/src/internal/index.ts +4 -0
- package/src/map-anthropic-stop-reason.ts +30 -0
- package/src/tool/bash_20241022.ts +33 -0
- package/src/tool/bash_20250124.ts +33 -0
- package/src/tool/code-execution_20250522.ts +61 -0
- package/src/tool/code-execution_20250825.ts +281 -0
- package/src/tool/code-execution_20260120.ts +315 -0
- package/src/tool/computer_20241022.ts +87 -0
- package/src/tool/computer_20250124.ts +130 -0
- package/src/tool/computer_20251124.ts +151 -0
- package/src/tool/memory_20250818.ts +62 -0
- package/src/tool/text-editor_20241022.ts +69 -0
- package/src/tool/text-editor_20250124.ts +69 -0
- package/src/tool/text-editor_20250429.ts +70 -0
- package/src/tool/text-editor_20250728.ts +86 -0
- package/src/tool/tool-search-bm25_20251119.ts +99 -0
- package/src/tool/tool-search-regex_20251119.ts +111 -0
- package/src/tool/web-fetch-20250910.ts +145 -0
- package/src/tool/web-fetch-20260209.ts +145 -0
- package/src/tool/web-search_20250305.ts +136 -0
- package/src/tool/web-search_20260209.ts +136 -0
- package/src/version.ts +6 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1099 @@
|
|
|
1
|
+
import { JSONObject, ProviderV3, LanguageModelV3 } from '@ai-sdk/provider';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
|
+
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents a single iteration in the usage breakdown.
|
|
8
|
+
* When compaction occurs, the API returns an iterations array showing
|
|
9
|
+
* usage for each sampling iteration (compaction + message).
|
|
10
|
+
*/
|
|
11
|
+
interface AnthropicUsageIteration {
|
|
12
|
+
type: 'compaction' | 'message';
|
|
13
|
+
/**
|
|
14
|
+
* Number of input tokens consumed in this iteration.
|
|
15
|
+
*/
|
|
16
|
+
inputTokens: number;
|
|
17
|
+
/**
|
|
18
|
+
* Number of output tokens generated in this iteration.
|
|
19
|
+
*/
|
|
20
|
+
outputTokens: number;
|
|
21
|
+
}
|
|
22
|
+
interface AnthropicMessageMetadata {
|
|
23
|
+
usage: JSONObject;
|
|
24
|
+
cacheCreationInputTokens: number | null;
|
|
25
|
+
stopSequence: string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Usage breakdown by iteration when compaction is triggered.
|
|
28
|
+
*
|
|
29
|
+
* When compaction occurs, this array contains usage for each sampling iteration.
|
|
30
|
+
* The first iteration is typically the compaction step, followed by the main
|
|
31
|
+
* message iteration.
|
|
32
|
+
*/
|
|
33
|
+
iterations: AnthropicUsageIteration[] | null;
|
|
34
|
+
/**
|
|
35
|
+
* Information about the container used in this request.
|
|
36
|
+
*
|
|
37
|
+
* This will be non-null if a container tool (e.g., code execution) was used.
|
|
38
|
+
* Information about the container used in the request (for the code execution tool).
|
|
39
|
+
*/
|
|
40
|
+
container: {
|
|
41
|
+
/**
|
|
42
|
+
* The time at which the container will expire (RFC3339 timestamp).
|
|
43
|
+
*/
|
|
44
|
+
expiresAt: string;
|
|
45
|
+
/**
|
|
46
|
+
* Identifier for the container used in this request.
|
|
47
|
+
*/
|
|
48
|
+
id: string;
|
|
49
|
+
/**
|
|
50
|
+
* Skills loaded in the container.
|
|
51
|
+
*/
|
|
52
|
+
skills: Array<{
|
|
53
|
+
/**
|
|
54
|
+
* Type of skill: either 'anthropic' (built-in) or 'custom' (user-defined).
|
|
55
|
+
*/
|
|
56
|
+
type: 'anthropic' | 'custom';
|
|
57
|
+
/**
|
|
58
|
+
* Skill ID (1-64 characters).
|
|
59
|
+
*/
|
|
60
|
+
skillId: string;
|
|
61
|
+
/**
|
|
62
|
+
* Skill version or 'latest' for most recent version (1-64 characters).
|
|
63
|
+
*/
|
|
64
|
+
version: string;
|
|
65
|
+
}> | null;
|
|
66
|
+
} | null;
|
|
67
|
+
/**
|
|
68
|
+
* Context management response.
|
|
69
|
+
*
|
|
70
|
+
* Information about context management strategies applied during the request.
|
|
71
|
+
*/
|
|
72
|
+
contextManagement: {
|
|
73
|
+
/**
|
|
74
|
+
* List of context management edits that were applied.
|
|
75
|
+
* Each item in the array is a specific type of context management edit.
|
|
76
|
+
*/
|
|
77
|
+
appliedEdits: Array<
|
|
78
|
+
/**
|
|
79
|
+
* Represents an edit where a certain number of tool uses and input tokens were cleared.
|
|
80
|
+
*/
|
|
81
|
+
{
|
|
82
|
+
/**
|
|
83
|
+
* The type of context management edit applied.
|
|
84
|
+
* Possible value: 'clear_tool_uses_20250919'
|
|
85
|
+
*/
|
|
86
|
+
type: 'clear_tool_uses_20250919';
|
|
87
|
+
/**
|
|
88
|
+
* Number of tool uses that were cleared by this edit.
|
|
89
|
+
* Minimum: 0
|
|
90
|
+
*/
|
|
91
|
+
clearedToolUses: number;
|
|
92
|
+
/**
|
|
93
|
+
* Number of input tokens cleared by this edit.
|
|
94
|
+
* Minimum: 0
|
|
95
|
+
*/
|
|
96
|
+
clearedInputTokens: number;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Represents an edit where a certain number of thinking turns and input tokens were cleared.
|
|
100
|
+
*/
|
|
101
|
+
| {
|
|
102
|
+
/**
|
|
103
|
+
* The type of context management edit applied.
|
|
104
|
+
* Possible value: 'clear_thinking_20251015'
|
|
105
|
+
*/
|
|
106
|
+
type: 'clear_thinking_20251015';
|
|
107
|
+
/**
|
|
108
|
+
* Number of thinking turns that were cleared by this edit.
|
|
109
|
+
* Minimum: 0
|
|
110
|
+
*/
|
|
111
|
+
clearedThinkingTurns: number;
|
|
112
|
+
/**
|
|
113
|
+
* Number of input tokens cleared by this edit.
|
|
114
|
+
* Minimum: 0
|
|
115
|
+
*/
|
|
116
|
+
clearedInputTokens: number;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Represents a compaction edit where the conversation context was summarized.
|
|
120
|
+
*/
|
|
121
|
+
| {
|
|
122
|
+
/**
|
|
123
|
+
* The type of context management edit applied.
|
|
124
|
+
* Possible value: 'compact_20260112'
|
|
125
|
+
*/
|
|
126
|
+
type: 'compact_20260112';
|
|
127
|
+
}>;
|
|
128
|
+
} | null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
type AnthropicMessagesModelId = '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' | (string & {});
|
|
132
|
+
declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
133
|
+
sendReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
134
|
+
structuredOutputMode: z.ZodOptional<z.ZodEnum<{
|
|
135
|
+
outputFormat: "outputFormat";
|
|
136
|
+
jsonTool: "jsonTool";
|
|
137
|
+
auto: "auto";
|
|
138
|
+
}>>;
|
|
139
|
+
thinking: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"adaptive">;
|
|
141
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
142
|
+
omitted: "omitted";
|
|
143
|
+
summarized: "summarized";
|
|
144
|
+
}>>;
|
|
145
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
146
|
+
type: z.ZodLiteral<"enabled">;
|
|
147
|
+
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
149
|
+
omitted: "omitted";
|
|
150
|
+
summarized: "summarized";
|
|
151
|
+
}>>;
|
|
152
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
153
|
+
type: z.ZodLiteral<"disabled">;
|
|
154
|
+
}, z.core.$strip>]>>;
|
|
155
|
+
disableParallelToolUse: z.ZodOptional<z.ZodBoolean>;
|
|
156
|
+
cacheControl: z.ZodOptional<z.ZodObject<{
|
|
157
|
+
type: z.ZodLiteral<"ephemeral">;
|
|
158
|
+
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
159
|
+
}, z.core.$strip>>;
|
|
160
|
+
mcpServers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
161
|
+
type: z.ZodLiteral<"url">;
|
|
162
|
+
name: z.ZodString;
|
|
163
|
+
url: z.ZodString;
|
|
164
|
+
authorizationToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
165
|
+
toolConfiguration: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
166
|
+
enabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
167
|
+
allowedTools: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
168
|
+
}, z.core.$strip>>>;
|
|
169
|
+
}, z.core.$strip>>>;
|
|
170
|
+
container: z.ZodOptional<z.ZodObject<{
|
|
171
|
+
id: z.ZodOptional<z.ZodString>;
|
|
172
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
173
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"anthropic">, z.ZodLiteral<"custom">]>;
|
|
174
|
+
skillId: z.ZodString;
|
|
175
|
+
version: z.ZodOptional<z.ZodString>;
|
|
176
|
+
}, z.core.$strip>>>;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
toolStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
179
|
+
effort: z.ZodOptional<z.ZodEnum<{
|
|
180
|
+
low: "low";
|
|
181
|
+
medium: "medium";
|
|
182
|
+
high: "high";
|
|
183
|
+
max: "max";
|
|
184
|
+
}>>;
|
|
185
|
+
speed: z.ZodOptional<z.ZodEnum<{
|
|
186
|
+
fast: "fast";
|
|
187
|
+
standard: "standard";
|
|
188
|
+
}>>;
|
|
189
|
+
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
190
|
+
prefill: z.ZodOptional<z.ZodString>;
|
|
191
|
+
contextManagement: z.ZodOptional<z.ZodObject<{
|
|
192
|
+
edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
193
|
+
type: z.ZodLiteral<"clear_tool_uses_20250919">;
|
|
194
|
+
trigger: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
195
|
+
type: z.ZodLiteral<"input_tokens">;
|
|
196
|
+
value: z.ZodNumber;
|
|
197
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
198
|
+
type: z.ZodLiteral<"tool_uses">;
|
|
199
|
+
value: z.ZodNumber;
|
|
200
|
+
}, z.core.$strip>]>>;
|
|
201
|
+
keep: z.ZodOptional<z.ZodObject<{
|
|
202
|
+
type: z.ZodLiteral<"tool_uses">;
|
|
203
|
+
value: z.ZodNumber;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
clearAtLeast: z.ZodOptional<z.ZodObject<{
|
|
206
|
+
type: z.ZodLiteral<"input_tokens">;
|
|
207
|
+
value: z.ZodNumber;
|
|
208
|
+
}, z.core.$strip>>;
|
|
209
|
+
clearToolInputs: z.ZodOptional<z.ZodBoolean>;
|
|
210
|
+
excludeTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
211
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
212
|
+
type: z.ZodLiteral<"clear_thinking_20251015">;
|
|
213
|
+
keep: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodObject<{
|
|
214
|
+
type: z.ZodLiteral<"thinking_turns">;
|
|
215
|
+
value: z.ZodNumber;
|
|
216
|
+
}, z.core.$strip>]>>;
|
|
217
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
218
|
+
type: z.ZodLiteral<"compact_20260112">;
|
|
219
|
+
trigger: z.ZodOptional<z.ZodObject<{
|
|
220
|
+
type: z.ZodLiteral<"input_tokens">;
|
|
221
|
+
value: z.ZodNumber;
|
|
222
|
+
}, z.core.$strip>>;
|
|
223
|
+
pauseAfterCompaction: z.ZodOptional<z.ZodBoolean>;
|
|
224
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
225
|
+
}, z.core.$strip>]>>;
|
|
226
|
+
}, z.core.$strip>>;
|
|
227
|
+
}, z.core.$strip>;
|
|
228
|
+
type AnthropicLanguageModelOptions = z.infer<typeof anthropicLanguageModelOptions>;
|
|
229
|
+
|
|
230
|
+
interface AnthropicToolOptions {
|
|
231
|
+
deferLoading?: boolean;
|
|
232
|
+
allowedCallers?: Array<'direct' | 'code_execution_20250825' | 'code_execution_20260120'>;
|
|
233
|
+
eagerInputStreaming?: boolean;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
declare const anthropicTools: {
|
|
237
|
+
/**
|
|
238
|
+
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
239
|
+
* allowing system operations, script execution, and command-line automation.
|
|
240
|
+
*
|
|
241
|
+
* Image results are supported.
|
|
242
|
+
*/
|
|
243
|
+
bash_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
244
|
+
command: string;
|
|
245
|
+
restart?: boolean;
|
|
246
|
+
}, {}>;
|
|
247
|
+
/**
|
|
248
|
+
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
249
|
+
* allowing system operations, script execution, and command-line automation.
|
|
250
|
+
*
|
|
251
|
+
* Image results are supported.
|
|
252
|
+
*/
|
|
253
|
+
bash_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
254
|
+
command: string;
|
|
255
|
+
restart?: boolean;
|
|
256
|
+
}, {}>;
|
|
257
|
+
/**
|
|
258
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
259
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
260
|
+
* the API conversation.
|
|
261
|
+
*
|
|
262
|
+
* The code execution tool allows Claude to run Bash commands and manipulate files,
|
|
263
|
+
* including writing code, in a secure, sandboxed environment.
|
|
264
|
+
*/
|
|
265
|
+
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
266
|
+
code: string;
|
|
267
|
+
}, {
|
|
268
|
+
type: "code_execution_result";
|
|
269
|
+
stdout: string;
|
|
270
|
+
stderr: string;
|
|
271
|
+
return_code: number;
|
|
272
|
+
content: Array<{
|
|
273
|
+
type: "code_execution_output";
|
|
274
|
+
file_id: string;
|
|
275
|
+
}>;
|
|
276
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
277
|
+
code: string;
|
|
278
|
+
}, {
|
|
279
|
+
type: "code_execution_result";
|
|
280
|
+
stdout: string;
|
|
281
|
+
stderr: string;
|
|
282
|
+
return_code: number;
|
|
283
|
+
content: Array<{
|
|
284
|
+
type: "code_execution_output";
|
|
285
|
+
file_id: string;
|
|
286
|
+
}>;
|
|
287
|
+
}>;
|
|
288
|
+
/**
|
|
289
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
290
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
291
|
+
* the API conversation.
|
|
292
|
+
*
|
|
293
|
+
* The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
|
|
294
|
+
* including writing code, in a secure, sandboxed environment.
|
|
295
|
+
*
|
|
296
|
+
* This is the latest version with enhanced Bash support and file operations.
|
|
297
|
+
*/
|
|
298
|
+
codeExecution_20250825: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
299
|
+
type: "programmatic-tool-call";
|
|
300
|
+
code: string;
|
|
301
|
+
} | {
|
|
302
|
+
type: "bash_code_execution";
|
|
303
|
+
command: string;
|
|
304
|
+
} | {
|
|
305
|
+
type: "text_editor_code_execution";
|
|
306
|
+
command: "view";
|
|
307
|
+
path: string;
|
|
308
|
+
} | {
|
|
309
|
+
type: "text_editor_code_execution";
|
|
310
|
+
command: "create";
|
|
311
|
+
path: string;
|
|
312
|
+
file_text?: string | null;
|
|
313
|
+
} | {
|
|
314
|
+
type: "text_editor_code_execution";
|
|
315
|
+
command: "str_replace";
|
|
316
|
+
path: string;
|
|
317
|
+
old_str: string;
|
|
318
|
+
new_str: string;
|
|
319
|
+
}, {
|
|
320
|
+
type: "code_execution_result";
|
|
321
|
+
stdout: string;
|
|
322
|
+
stderr: string;
|
|
323
|
+
return_code: number;
|
|
324
|
+
content: Array<{
|
|
325
|
+
type: "code_execution_output";
|
|
326
|
+
file_id: string;
|
|
327
|
+
}>;
|
|
328
|
+
} | {
|
|
329
|
+
type: "bash_code_execution_result";
|
|
330
|
+
content: Array<{
|
|
331
|
+
type: "bash_code_execution_output";
|
|
332
|
+
file_id: string;
|
|
333
|
+
}>;
|
|
334
|
+
stdout: string;
|
|
335
|
+
stderr: string;
|
|
336
|
+
return_code: number;
|
|
337
|
+
} | {
|
|
338
|
+
type: "bash_code_execution_tool_result_error";
|
|
339
|
+
error_code: string;
|
|
340
|
+
} | {
|
|
341
|
+
type: "text_editor_code_execution_tool_result_error";
|
|
342
|
+
error_code: string;
|
|
343
|
+
} | {
|
|
344
|
+
type: "text_editor_code_execution_view_result";
|
|
345
|
+
content: string;
|
|
346
|
+
file_type: string;
|
|
347
|
+
num_lines: number | null;
|
|
348
|
+
start_line: number | null;
|
|
349
|
+
total_lines: number | null;
|
|
350
|
+
} | {
|
|
351
|
+
type: "text_editor_code_execution_create_result";
|
|
352
|
+
is_file_update: boolean;
|
|
353
|
+
} | {
|
|
354
|
+
type: "text_editor_code_execution_str_replace_result";
|
|
355
|
+
lines: string[] | null;
|
|
356
|
+
new_lines: number | null;
|
|
357
|
+
new_start: number | null;
|
|
358
|
+
old_lines: number | null;
|
|
359
|
+
old_start: number | null;
|
|
360
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
361
|
+
type: "programmatic-tool-call";
|
|
362
|
+
code: string;
|
|
363
|
+
} | {
|
|
364
|
+
type: "bash_code_execution";
|
|
365
|
+
command: string;
|
|
366
|
+
} | {
|
|
367
|
+
type: "text_editor_code_execution";
|
|
368
|
+
command: "view";
|
|
369
|
+
path: string;
|
|
370
|
+
} | {
|
|
371
|
+
type: "text_editor_code_execution";
|
|
372
|
+
command: "create";
|
|
373
|
+
path: string;
|
|
374
|
+
file_text?: string | null;
|
|
375
|
+
} | {
|
|
376
|
+
type: "text_editor_code_execution";
|
|
377
|
+
command: "str_replace";
|
|
378
|
+
path: string;
|
|
379
|
+
old_str: string;
|
|
380
|
+
new_str: string;
|
|
381
|
+
}, {
|
|
382
|
+
type: "code_execution_result";
|
|
383
|
+
stdout: string;
|
|
384
|
+
stderr: string;
|
|
385
|
+
return_code: number;
|
|
386
|
+
content: Array<{
|
|
387
|
+
type: "code_execution_output";
|
|
388
|
+
file_id: string;
|
|
389
|
+
}>;
|
|
390
|
+
} | {
|
|
391
|
+
type: "bash_code_execution_result";
|
|
392
|
+
content: Array<{
|
|
393
|
+
type: "bash_code_execution_output";
|
|
394
|
+
file_id: string;
|
|
395
|
+
}>;
|
|
396
|
+
stdout: string;
|
|
397
|
+
stderr: string;
|
|
398
|
+
return_code: number;
|
|
399
|
+
} | {
|
|
400
|
+
type: "bash_code_execution_tool_result_error";
|
|
401
|
+
error_code: string;
|
|
402
|
+
} | {
|
|
403
|
+
type: "text_editor_code_execution_tool_result_error";
|
|
404
|
+
error_code: string;
|
|
405
|
+
} | {
|
|
406
|
+
type: "text_editor_code_execution_view_result";
|
|
407
|
+
content: string;
|
|
408
|
+
file_type: string;
|
|
409
|
+
num_lines: number | null;
|
|
410
|
+
start_line: number | null;
|
|
411
|
+
total_lines: number | null;
|
|
412
|
+
} | {
|
|
413
|
+
type: "text_editor_code_execution_create_result";
|
|
414
|
+
is_file_update: boolean;
|
|
415
|
+
} | {
|
|
416
|
+
type: "text_editor_code_execution_str_replace_result";
|
|
417
|
+
lines: string[] | null;
|
|
418
|
+
new_lines: number | null;
|
|
419
|
+
new_start: number | null;
|
|
420
|
+
old_lines: number | null;
|
|
421
|
+
old_start: number | null;
|
|
422
|
+
}>;
|
|
423
|
+
/**
|
|
424
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
425
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
426
|
+
* the API conversation.
|
|
427
|
+
*
|
|
428
|
+
* The code execution tool allows Claude to run both Python and Bash commands and manipulate files,
|
|
429
|
+
* including writing code, in a secure, sandboxed environment.
|
|
430
|
+
*
|
|
431
|
+
* This is the recommended version. Does not require a beta header.
|
|
432
|
+
*
|
|
433
|
+
* Supported models: Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, Opus 4.5
|
|
434
|
+
*/
|
|
435
|
+
codeExecution_20260120: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
436
|
+
type: "programmatic-tool-call";
|
|
437
|
+
code: string;
|
|
438
|
+
} | {
|
|
439
|
+
type: "bash_code_execution";
|
|
440
|
+
command: string;
|
|
441
|
+
} | {
|
|
442
|
+
type: "text_editor_code_execution";
|
|
443
|
+
command: "view";
|
|
444
|
+
path: string;
|
|
445
|
+
} | {
|
|
446
|
+
type: "text_editor_code_execution";
|
|
447
|
+
command: "create";
|
|
448
|
+
path: string;
|
|
449
|
+
file_text?: string | null;
|
|
450
|
+
} | {
|
|
451
|
+
type: "text_editor_code_execution";
|
|
452
|
+
command: "str_replace";
|
|
453
|
+
path: string;
|
|
454
|
+
old_str: string;
|
|
455
|
+
new_str: string;
|
|
456
|
+
}, {
|
|
457
|
+
type: "code_execution_result";
|
|
458
|
+
stdout: string;
|
|
459
|
+
stderr: string;
|
|
460
|
+
return_code: number;
|
|
461
|
+
content: Array<{
|
|
462
|
+
type: "code_execution_output";
|
|
463
|
+
file_id: string;
|
|
464
|
+
}>;
|
|
465
|
+
} | {
|
|
466
|
+
type: "encrypted_code_execution_result";
|
|
467
|
+
encrypted_stdout: string;
|
|
468
|
+
stderr: string;
|
|
469
|
+
return_code: number;
|
|
470
|
+
content: Array<{
|
|
471
|
+
type: "code_execution_output";
|
|
472
|
+
file_id: string;
|
|
473
|
+
}>;
|
|
474
|
+
} | {
|
|
475
|
+
type: "bash_code_execution_result";
|
|
476
|
+
content: Array<{
|
|
477
|
+
type: "bash_code_execution_output";
|
|
478
|
+
file_id: string;
|
|
479
|
+
}>;
|
|
480
|
+
stdout: string;
|
|
481
|
+
stderr: string;
|
|
482
|
+
return_code: number;
|
|
483
|
+
} | {
|
|
484
|
+
type: "bash_code_execution_tool_result_error";
|
|
485
|
+
error_code: string;
|
|
486
|
+
} | {
|
|
487
|
+
type: "text_editor_code_execution_tool_result_error";
|
|
488
|
+
error_code: string;
|
|
489
|
+
} | {
|
|
490
|
+
type: "text_editor_code_execution_view_result";
|
|
491
|
+
content: string;
|
|
492
|
+
file_type: string;
|
|
493
|
+
num_lines: number | null;
|
|
494
|
+
start_line: number | null;
|
|
495
|
+
total_lines: number | null;
|
|
496
|
+
} | {
|
|
497
|
+
type: "text_editor_code_execution_create_result";
|
|
498
|
+
is_file_update: boolean;
|
|
499
|
+
} | {
|
|
500
|
+
type: "text_editor_code_execution_str_replace_result";
|
|
501
|
+
lines: string[] | null;
|
|
502
|
+
new_lines: number | null;
|
|
503
|
+
new_start: number | null;
|
|
504
|
+
old_lines: number | null;
|
|
505
|
+
old_start: number | null;
|
|
506
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
507
|
+
type: "programmatic-tool-call";
|
|
508
|
+
code: string;
|
|
509
|
+
} | {
|
|
510
|
+
type: "bash_code_execution";
|
|
511
|
+
command: string;
|
|
512
|
+
} | {
|
|
513
|
+
type: "text_editor_code_execution";
|
|
514
|
+
command: "view";
|
|
515
|
+
path: string;
|
|
516
|
+
} | {
|
|
517
|
+
type: "text_editor_code_execution";
|
|
518
|
+
command: "create";
|
|
519
|
+
path: string;
|
|
520
|
+
file_text?: string | null;
|
|
521
|
+
} | {
|
|
522
|
+
type: "text_editor_code_execution";
|
|
523
|
+
command: "str_replace";
|
|
524
|
+
path: string;
|
|
525
|
+
old_str: string;
|
|
526
|
+
new_str: string;
|
|
527
|
+
}, {
|
|
528
|
+
type: "code_execution_result";
|
|
529
|
+
stdout: string;
|
|
530
|
+
stderr: string;
|
|
531
|
+
return_code: number;
|
|
532
|
+
content: Array<{
|
|
533
|
+
type: "code_execution_output";
|
|
534
|
+
file_id: string;
|
|
535
|
+
}>;
|
|
536
|
+
} | {
|
|
537
|
+
type: "encrypted_code_execution_result";
|
|
538
|
+
encrypted_stdout: string;
|
|
539
|
+
stderr: string;
|
|
540
|
+
return_code: number;
|
|
541
|
+
content: Array<{
|
|
542
|
+
type: "code_execution_output";
|
|
543
|
+
file_id: string;
|
|
544
|
+
}>;
|
|
545
|
+
} | {
|
|
546
|
+
type: "bash_code_execution_result";
|
|
547
|
+
content: Array<{
|
|
548
|
+
type: "bash_code_execution_output";
|
|
549
|
+
file_id: string;
|
|
550
|
+
}>;
|
|
551
|
+
stdout: string;
|
|
552
|
+
stderr: string;
|
|
553
|
+
return_code: number;
|
|
554
|
+
} | {
|
|
555
|
+
type: "bash_code_execution_tool_result_error";
|
|
556
|
+
error_code: string;
|
|
557
|
+
} | {
|
|
558
|
+
type: "text_editor_code_execution_tool_result_error";
|
|
559
|
+
error_code: string;
|
|
560
|
+
} | {
|
|
561
|
+
type: "text_editor_code_execution_view_result";
|
|
562
|
+
content: string;
|
|
563
|
+
file_type: string;
|
|
564
|
+
num_lines: number | null;
|
|
565
|
+
start_line: number | null;
|
|
566
|
+
total_lines: number | null;
|
|
567
|
+
} | {
|
|
568
|
+
type: "text_editor_code_execution_create_result";
|
|
569
|
+
is_file_update: boolean;
|
|
570
|
+
} | {
|
|
571
|
+
type: "text_editor_code_execution_str_replace_result";
|
|
572
|
+
lines: string[] | null;
|
|
573
|
+
new_lines: number | null;
|
|
574
|
+
new_start: number | null;
|
|
575
|
+
old_lines: number | null;
|
|
576
|
+
old_start: number | null;
|
|
577
|
+
}>;
|
|
578
|
+
/**
|
|
579
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
580
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
581
|
+
*
|
|
582
|
+
* Image results are supported.
|
|
583
|
+
*
|
|
584
|
+
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
585
|
+
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
586
|
+
* @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.
|
|
587
|
+
*/
|
|
588
|
+
computer_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
589
|
+
action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
|
|
590
|
+
coordinate?: number[];
|
|
591
|
+
text?: string;
|
|
592
|
+
}, {
|
|
593
|
+
displayWidthPx: number;
|
|
594
|
+
displayHeightPx: number;
|
|
595
|
+
displayNumber?: number;
|
|
596
|
+
}>;
|
|
597
|
+
/**
|
|
598
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
599
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
600
|
+
*
|
|
601
|
+
* Image results are supported.
|
|
602
|
+
*
|
|
603
|
+
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
604
|
+
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
605
|
+
* @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.
|
|
606
|
+
*/
|
|
607
|
+
computer_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
608
|
+
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";
|
|
609
|
+
coordinate?: [number, number];
|
|
610
|
+
duration?: number;
|
|
611
|
+
scroll_amount?: number;
|
|
612
|
+
scroll_direction?: "up" | "down" | "left" | "right";
|
|
613
|
+
start_coordinate?: [number, number];
|
|
614
|
+
text?: string;
|
|
615
|
+
}, {
|
|
616
|
+
displayWidthPx: number;
|
|
617
|
+
displayHeightPx: number;
|
|
618
|
+
displayNumber?: number;
|
|
619
|
+
}>;
|
|
620
|
+
/**
|
|
621
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
622
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
623
|
+
*
|
|
624
|
+
* This version adds the zoom action for detailed screen region inspection.
|
|
625
|
+
*
|
|
626
|
+
* Image results are supported.
|
|
627
|
+
*
|
|
628
|
+
* Supported models: Claude Opus 4.5
|
|
629
|
+
*
|
|
630
|
+
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
631
|
+
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
632
|
+
* @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.
|
|
633
|
+
* @param enableZoom - Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
|
|
634
|
+
*/
|
|
635
|
+
computer_20251124: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
636
|
+
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";
|
|
637
|
+
coordinate?: [number, number];
|
|
638
|
+
duration?: number;
|
|
639
|
+
region?: [number, number, number, number];
|
|
640
|
+
scroll_amount?: number;
|
|
641
|
+
scroll_direction?: "up" | "down" | "left" | "right";
|
|
642
|
+
start_coordinate?: [number, number];
|
|
643
|
+
text?: string;
|
|
644
|
+
}, {
|
|
645
|
+
displayWidthPx: number;
|
|
646
|
+
displayHeightPx: number;
|
|
647
|
+
displayNumber?: number;
|
|
648
|
+
enableZoom?: boolean;
|
|
649
|
+
}>;
|
|
650
|
+
/**
|
|
651
|
+
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
652
|
+
* Claude can create, read, update, and delete files that persist between sessions,
|
|
653
|
+
* allowing it to build knowledge over time without keeping everything in the context window.
|
|
654
|
+
* The memory tool operates client-side—you control where and how the data is stored through your own infrastructure.
|
|
655
|
+
*
|
|
656
|
+
* Supported models: Claude Sonnet 4.5, Claude Sonnet 4, Claude Opus 4.1, Claude Opus 4.
|
|
657
|
+
*/
|
|
658
|
+
memory_20250818: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
659
|
+
command: "view";
|
|
660
|
+
path: string;
|
|
661
|
+
view_range?: [number, number];
|
|
662
|
+
} | {
|
|
663
|
+
command: "create";
|
|
664
|
+
path: string;
|
|
665
|
+
file_text: string;
|
|
666
|
+
} | {
|
|
667
|
+
command: "str_replace";
|
|
668
|
+
path: string;
|
|
669
|
+
old_str: string;
|
|
670
|
+
new_str: string;
|
|
671
|
+
} | {
|
|
672
|
+
command: "insert";
|
|
673
|
+
path: string;
|
|
674
|
+
insert_line: number;
|
|
675
|
+
insert_text: string;
|
|
676
|
+
} | {
|
|
677
|
+
command: "delete";
|
|
678
|
+
path: string;
|
|
679
|
+
} | {
|
|
680
|
+
command: "rename";
|
|
681
|
+
old_path: string;
|
|
682
|
+
new_path: string;
|
|
683
|
+
}, {}>;
|
|
684
|
+
/**
|
|
685
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
686
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
687
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
688
|
+
*
|
|
689
|
+
* Supported models: Claude Sonnet 3.5
|
|
690
|
+
*/
|
|
691
|
+
textEditor_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
692
|
+
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
693
|
+
path: string;
|
|
694
|
+
file_text?: string;
|
|
695
|
+
insert_line?: number;
|
|
696
|
+
new_str?: string;
|
|
697
|
+
insert_text?: string;
|
|
698
|
+
old_str?: string;
|
|
699
|
+
view_range?: number[];
|
|
700
|
+
}, {}>;
|
|
701
|
+
/**
|
|
702
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
703
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
704
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
705
|
+
*
|
|
706
|
+
* Supported models: Claude Sonnet 3.7
|
|
707
|
+
*/
|
|
708
|
+
textEditor_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
709
|
+
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
710
|
+
path: string;
|
|
711
|
+
file_text?: string;
|
|
712
|
+
insert_line?: number;
|
|
713
|
+
new_str?: string;
|
|
714
|
+
insert_text?: string;
|
|
715
|
+
old_str?: string;
|
|
716
|
+
view_range?: number[];
|
|
717
|
+
}, {}>;
|
|
718
|
+
/**
|
|
719
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
720
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
721
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
722
|
+
*
|
|
723
|
+
* Note: This version does not support the "undo_edit" command.
|
|
724
|
+
*
|
|
725
|
+
* @deprecated Use textEditor_20250728 instead
|
|
726
|
+
*/
|
|
727
|
+
textEditor_20250429: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
728
|
+
command: "view" | "create" | "str_replace" | "insert";
|
|
729
|
+
path: string;
|
|
730
|
+
file_text?: string;
|
|
731
|
+
insert_line?: number;
|
|
732
|
+
new_str?: string;
|
|
733
|
+
insert_text?: string;
|
|
734
|
+
old_str?: string;
|
|
735
|
+
view_range?: number[];
|
|
736
|
+
}, {}>;
|
|
737
|
+
/**
|
|
738
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
739
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
740
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
741
|
+
*
|
|
742
|
+
* Note: This version does not support the "undo_edit" command and adds optional max_characters parameter.
|
|
743
|
+
*
|
|
744
|
+
* Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
|
|
745
|
+
*
|
|
746
|
+
* @param maxCharacters - Optional maximum number of characters to view in the file
|
|
747
|
+
*/
|
|
748
|
+
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactory<{
|
|
749
|
+
command: "view" | "create" | "str_replace" | "insert";
|
|
750
|
+
path: string;
|
|
751
|
+
file_text?: string;
|
|
752
|
+
insert_line?: number;
|
|
753
|
+
new_str?: string;
|
|
754
|
+
insert_text?: string;
|
|
755
|
+
old_str?: string;
|
|
756
|
+
view_range?: number[];
|
|
757
|
+
}, {
|
|
758
|
+
maxCharacters?: number;
|
|
759
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
760
|
+
command: "view" | "create" | "str_replace" | "insert";
|
|
761
|
+
path: string;
|
|
762
|
+
file_text?: string;
|
|
763
|
+
insert_line?: number;
|
|
764
|
+
new_str?: string;
|
|
765
|
+
insert_text?: string;
|
|
766
|
+
old_str?: string;
|
|
767
|
+
view_range?: number[];
|
|
768
|
+
}, unknown>;
|
|
769
|
+
/**
|
|
770
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
771
|
+
*
|
|
772
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
773
|
+
* @param allowedDomains - Only fetch from these domains
|
|
774
|
+
* @param blockedDomains - Never fetch from these domains
|
|
775
|
+
* @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.
|
|
776
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
777
|
+
*/
|
|
778
|
+
webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
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
|
+
}, {
|
|
801
|
+
maxUses?: number;
|
|
802
|
+
allowedDomains?: string[];
|
|
803
|
+
blockedDomains?: string[];
|
|
804
|
+
citations?: {
|
|
805
|
+
enabled: boolean;
|
|
806
|
+
};
|
|
807
|
+
maxContentTokens?: number;
|
|
808
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
809
|
+
url: string;
|
|
810
|
+
}, {
|
|
811
|
+
type: "web_fetch_result";
|
|
812
|
+
url: string;
|
|
813
|
+
content: {
|
|
814
|
+
type: "document";
|
|
815
|
+
title: string | null;
|
|
816
|
+
citations?: {
|
|
817
|
+
enabled: boolean;
|
|
818
|
+
};
|
|
819
|
+
source: {
|
|
820
|
+
type: "base64";
|
|
821
|
+
mediaType: "application/pdf";
|
|
822
|
+
data: string;
|
|
823
|
+
} | {
|
|
824
|
+
type: "text";
|
|
825
|
+
mediaType: "text/plain";
|
|
826
|
+
data: string;
|
|
827
|
+
};
|
|
828
|
+
};
|
|
829
|
+
retrievedAt: string | null;
|
|
830
|
+
}>;
|
|
831
|
+
/**
|
|
832
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
833
|
+
*
|
|
834
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
835
|
+
* @param allowedDomains - Only fetch from these domains
|
|
836
|
+
* @param blockedDomains - Never fetch from these domains
|
|
837
|
+
* @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.
|
|
838
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
839
|
+
*/
|
|
840
|
+
webFetch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
841
|
+
url: string;
|
|
842
|
+
}, {
|
|
843
|
+
type: "web_fetch_result";
|
|
844
|
+
url: string;
|
|
845
|
+
content: {
|
|
846
|
+
type: "document";
|
|
847
|
+
title: string | null;
|
|
848
|
+
citations?: {
|
|
849
|
+
enabled: boolean;
|
|
850
|
+
};
|
|
851
|
+
source: {
|
|
852
|
+
type: "base64";
|
|
853
|
+
mediaType: "application/pdf";
|
|
854
|
+
data: string;
|
|
855
|
+
} | {
|
|
856
|
+
type: "text";
|
|
857
|
+
mediaType: "text/plain";
|
|
858
|
+
data: string;
|
|
859
|
+
};
|
|
860
|
+
};
|
|
861
|
+
retrievedAt: string | null;
|
|
862
|
+
}, {
|
|
863
|
+
maxUses?: number;
|
|
864
|
+
allowedDomains?: string[];
|
|
865
|
+
blockedDomains?: string[];
|
|
866
|
+
citations?: {
|
|
867
|
+
enabled: boolean;
|
|
868
|
+
};
|
|
869
|
+
maxContentTokens?: number;
|
|
870
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
871
|
+
url: string;
|
|
872
|
+
}, {
|
|
873
|
+
type: "web_fetch_result";
|
|
874
|
+
url: string;
|
|
875
|
+
content: {
|
|
876
|
+
type: "document";
|
|
877
|
+
title: string | null;
|
|
878
|
+
citations?: {
|
|
879
|
+
enabled: boolean;
|
|
880
|
+
};
|
|
881
|
+
source: {
|
|
882
|
+
type: "base64";
|
|
883
|
+
mediaType: "application/pdf";
|
|
884
|
+
data: string;
|
|
885
|
+
} | {
|
|
886
|
+
type: "text";
|
|
887
|
+
mediaType: "text/plain";
|
|
888
|
+
data: string;
|
|
889
|
+
};
|
|
890
|
+
};
|
|
891
|
+
retrievedAt: string | null;
|
|
892
|
+
}>;
|
|
893
|
+
/**
|
|
894
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
895
|
+
*
|
|
896
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
897
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
898
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
899
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
900
|
+
*/
|
|
901
|
+
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
902
|
+
query: string;
|
|
903
|
+
}, {
|
|
904
|
+
type: "web_search_result";
|
|
905
|
+
url: string;
|
|
906
|
+
title: string | null;
|
|
907
|
+
pageAge: string | null;
|
|
908
|
+
encryptedContent: string;
|
|
909
|
+
}[], {
|
|
910
|
+
maxUses?: number;
|
|
911
|
+
allowedDomains?: string[];
|
|
912
|
+
blockedDomains?: string[];
|
|
913
|
+
userLocation?: {
|
|
914
|
+
type: "approximate";
|
|
915
|
+
city?: string;
|
|
916
|
+
region?: string;
|
|
917
|
+
country?: string;
|
|
918
|
+
timezone?: string;
|
|
919
|
+
};
|
|
920
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
921
|
+
query: string;
|
|
922
|
+
}, {
|
|
923
|
+
type: "web_search_result";
|
|
924
|
+
url: string;
|
|
925
|
+
title: string | null;
|
|
926
|
+
pageAge: string | null;
|
|
927
|
+
encryptedContent: string;
|
|
928
|
+
}[]>;
|
|
929
|
+
/**
|
|
930
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
931
|
+
*
|
|
932
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
933
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
934
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
935
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
936
|
+
*/
|
|
937
|
+
webSearch_20260209: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
938
|
+
query: string;
|
|
939
|
+
}, {
|
|
940
|
+
type: "web_search_result";
|
|
941
|
+
url: string;
|
|
942
|
+
title: string | null;
|
|
943
|
+
pageAge: string | null;
|
|
944
|
+
encryptedContent: string;
|
|
945
|
+
}[], {
|
|
946
|
+
maxUses?: number;
|
|
947
|
+
allowedDomains?: string[];
|
|
948
|
+
blockedDomains?: string[];
|
|
949
|
+
userLocation?: {
|
|
950
|
+
type: "approximate";
|
|
951
|
+
city?: string;
|
|
952
|
+
region?: string;
|
|
953
|
+
country?: string;
|
|
954
|
+
timezone?: string;
|
|
955
|
+
};
|
|
956
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
957
|
+
query: string;
|
|
958
|
+
}, {
|
|
959
|
+
type: "web_search_result";
|
|
960
|
+
url: string;
|
|
961
|
+
title: string | null;
|
|
962
|
+
pageAge: string | null;
|
|
963
|
+
encryptedContent: string;
|
|
964
|
+
}[]>;
|
|
965
|
+
/**
|
|
966
|
+
* Creates a tool search tool that uses regex patterns to find tools.
|
|
967
|
+
*
|
|
968
|
+
* The tool search tool enables Claude to work with hundreds or thousands of tools
|
|
969
|
+
* by dynamically discovering and loading them on-demand. Instead of loading all
|
|
970
|
+
* tool definitions into the context window upfront, Claude searches your tool
|
|
971
|
+
* catalog and loads only the tools it needs.
|
|
972
|
+
*
|
|
973
|
+
* Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
|
|
974
|
+
* to mark them for deferred loading.
|
|
975
|
+
*
|
|
976
|
+
* Supported models: Claude Opus 4.5, Claude Sonnet 4.5
|
|
977
|
+
*/
|
|
978
|
+
toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
979
|
+
pattern: string;
|
|
980
|
+
limit?: number;
|
|
981
|
+
}, {
|
|
982
|
+
type: "tool_reference";
|
|
983
|
+
toolName: string;
|
|
984
|
+
}[], {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
985
|
+
pattern: string;
|
|
986
|
+
limit?: number;
|
|
987
|
+
}, {
|
|
988
|
+
type: "tool_reference";
|
|
989
|
+
toolName: string;
|
|
990
|
+
}[]>;
|
|
991
|
+
/**
|
|
992
|
+
* Creates a tool search tool that uses BM25 (natural language) to find tools.
|
|
993
|
+
*
|
|
994
|
+
* The tool search tool enables Claude to work with hundreds or thousands of tools
|
|
995
|
+
* by dynamically discovering and loading them on-demand. Instead of loading all
|
|
996
|
+
* tool definitions into the context window upfront, Claude searches your tool
|
|
997
|
+
* catalog and loads only the tools it needs.
|
|
998
|
+
*
|
|
999
|
+
* Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
|
|
1000
|
+
* to mark them for deferred loading.
|
|
1001
|
+
*
|
|
1002
|
+
* Supported models: Claude Opus 4.5, Claude Sonnet 4.5
|
|
1003
|
+
*/
|
|
1004
|
+
toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
1005
|
+
query: string;
|
|
1006
|
+
limit?: number;
|
|
1007
|
+
}, {
|
|
1008
|
+
type: "tool_reference";
|
|
1009
|
+
toolName: string;
|
|
1010
|
+
}[], {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
1011
|
+
query: string;
|
|
1012
|
+
limit?: number;
|
|
1013
|
+
}, {
|
|
1014
|
+
type: "tool_reference";
|
|
1015
|
+
toolName: string;
|
|
1016
|
+
}[]>;
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
interface AnthropicProvider extends ProviderV3 {
|
|
1020
|
+
/**
|
|
1021
|
+
* Creates a model for text generation.
|
|
1022
|
+
*/
|
|
1023
|
+
(modelId: AnthropicMessagesModelId): LanguageModelV3;
|
|
1024
|
+
/**
|
|
1025
|
+
* Creates a model for text generation.
|
|
1026
|
+
*/
|
|
1027
|
+
languageModel(modelId: AnthropicMessagesModelId): LanguageModelV3;
|
|
1028
|
+
chat(modelId: AnthropicMessagesModelId): LanguageModelV3;
|
|
1029
|
+
messages(modelId: AnthropicMessagesModelId): LanguageModelV3;
|
|
1030
|
+
/**
|
|
1031
|
+
* @deprecated Use `embeddingModel` instead.
|
|
1032
|
+
*/
|
|
1033
|
+
textEmbeddingModel(modelId: string): never;
|
|
1034
|
+
/**
|
|
1035
|
+
* Anthropic-specific computer use tool.
|
|
1036
|
+
*/
|
|
1037
|
+
tools: typeof anthropicTools;
|
|
1038
|
+
}
|
|
1039
|
+
interface AnthropicProviderSettings {
|
|
1040
|
+
/**
|
|
1041
|
+
* Use a different URL prefix for API calls, e.g. to use proxy servers.
|
|
1042
|
+
* The default prefix is `https://api.anthropic.com/v1`.
|
|
1043
|
+
*/
|
|
1044
|
+
baseURL?: string;
|
|
1045
|
+
/**
|
|
1046
|
+
* API key that is being send using the `x-api-key` header.
|
|
1047
|
+
* It defaults to the `ANTHROPIC_API_KEY` environment variable.
|
|
1048
|
+
* Only one of `apiKey` or `authToken` is required.
|
|
1049
|
+
*/
|
|
1050
|
+
apiKey?: string;
|
|
1051
|
+
/**
|
|
1052
|
+
* Auth token that is being sent using the `Authorization: Bearer` header.
|
|
1053
|
+
* It defaults to the `ANTHROPIC_AUTH_TOKEN` environment variable.
|
|
1054
|
+
* Only one of `apiKey` or `authToken` is required.
|
|
1055
|
+
*/
|
|
1056
|
+
authToken?: string;
|
|
1057
|
+
/**
|
|
1058
|
+
* Custom headers to include in the requests.
|
|
1059
|
+
*/
|
|
1060
|
+
headers?: Record<string, string>;
|
|
1061
|
+
/**
|
|
1062
|
+
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
1063
|
+
* or to provide a custom fetch implementation for e.g. testing.
|
|
1064
|
+
*/
|
|
1065
|
+
fetch?: FetchFunction;
|
|
1066
|
+
generateId?: () => string;
|
|
1067
|
+
/**
|
|
1068
|
+
* Custom provider name
|
|
1069
|
+
* Defaults to 'anthropic.messages'.
|
|
1070
|
+
*/
|
|
1071
|
+
name?: string;
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Create an Anthropic provider instance.
|
|
1075
|
+
*/
|
|
1076
|
+
declare function createAnthropic(options?: AnthropicProviderSettings): AnthropicProvider;
|
|
1077
|
+
/**
|
|
1078
|
+
* Default Anthropic provider instance.
|
|
1079
|
+
*/
|
|
1080
|
+
declare const anthropic: AnthropicProvider;
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Sets the Anthropic container ID in the provider options based on
|
|
1084
|
+
* any previous step's provider metadata.
|
|
1085
|
+
*
|
|
1086
|
+
* Searches backwards through steps to find the most recent container ID.
|
|
1087
|
+
* You can use this function in `prepareStep` to forward the container ID between steps.
|
|
1088
|
+
*/
|
|
1089
|
+
declare function forwardAnthropicContainerIdFromLastStep({ steps, }: {
|
|
1090
|
+
steps: Array<{
|
|
1091
|
+
providerMetadata?: Record<string, JSONObject>;
|
|
1092
|
+
}>;
|
|
1093
|
+
}): undefined | {
|
|
1094
|
+
providerOptions?: Record<string, JSONObject>;
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
declare const VERSION: string;
|
|
1098
|
+
|
|
1099
|
+
export { type AnthropicLanguageModelOptions, type AnthropicMessageMetadata, type AnthropicProvider, type AnthropicLanguageModelOptions as AnthropicProviderOptions, type AnthropicProviderSettings, type AnthropicToolOptions, type AnthropicUsageIteration, VERSION, anthropic, createAnthropic, forwardAnthropicContainerIdFromLastStep };
|