@ai-sdk/anthropic 2.0.0-alpha.9 → 2.0.0-beta.10

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/dist/index.d.ts CHANGED
@@ -1,514 +1,157 @@
1
- import { z } from 'zod';
1
+ import { z } from 'zod/v4';
2
2
  import { ProviderV2, LanguageModelV2 } from '@ai-sdk/provider';
3
- import { ToolResultContent, FetchFunction } from '@ai-sdk/provider-utils';
3
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
+ import { FetchFunction } from '@ai-sdk/provider-utils';
4
5
 
5
- type AnthropicMessagesModelId = 'claude-4-opus-20250514' | 'claude-4-sonnet-20250514' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
6
+ type AnthropicMessagesModelId = 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-sonnet-latest' | 'claude-3-5-sonnet-20241022' | 'claude-3-5-sonnet-20240620' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-opus-latest' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229' | 'claude-3-haiku-20240307' | (string & {});
6
7
  declare const anthropicProviderOptions: z.ZodObject<{
7
- /**
8
- Include reasoning content in requests sent to the model. Defaults to `true`.
9
-
10
- If you are experiencing issues with the model handling requests involving
11
- */
12
8
  sendReasoning: z.ZodOptional<z.ZodBoolean>;
13
9
  thinking: z.ZodOptional<z.ZodObject<{
14
- type: z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>;
10
+ type: z.ZodUnion<readonly [z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>;
15
11
  budgetTokens: z.ZodOptional<z.ZodNumber>;
16
- }, "strip", z.ZodTypeAny, {
17
- type: "enabled" | "disabled";
18
- budgetTokens?: number | undefined;
19
- }, {
20
- type: "enabled" | "disabled";
21
- budgetTokens?: number | undefined;
22
- }>>;
23
- /**
24
- * Web search tool configuration for Claude models that support it.
25
- * When provided, automatically adds the web search tool to the request.
26
- */
27
- webSearch: z.ZodOptional<z.ZodObject<{
28
- /**
29
- * Limit the number of searches per request (optional)
30
- * Defaults to 5 if not specified
31
- */
32
- maxUses: z.ZodOptional<z.ZodNumber>;
33
- /**
34
- * Only include results from these domains (optional)
35
- * Cannot be used with blockedDomains
36
- */
37
- allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
38
- /**
39
- * Never include results from these domains (optional)
40
- * Cannot be used with allowedDomains
41
- */
42
- blockedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
43
- /**
44
- * Localize search results based on user location (optional)
45
- */
46
- userLocation: z.ZodOptional<z.ZodObject<{
47
- type: z.ZodLiteral<"approximate">;
48
- city: z.ZodOptional<z.ZodString>;
49
- region: z.ZodOptional<z.ZodString>;
50
- country: z.ZodString;
51
- timezone: z.ZodOptional<z.ZodString>;
52
- }, "strip", z.ZodTypeAny, {
53
- type: "approximate";
54
- country: string;
55
- city?: string | undefined;
56
- region?: string | undefined;
57
- timezone?: string | undefined;
58
- }, {
59
- type: "approximate";
60
- country: string;
61
- city?: string | undefined;
62
- region?: string | undefined;
63
- timezone?: string | undefined;
64
- }>>;
65
- }, "strip", z.ZodTypeAny, {
66
- maxUses?: number | undefined;
67
- allowedDomains?: string[] | undefined;
68
- blockedDomains?: string[] | undefined;
69
- userLocation?: {
70
- type: "approximate";
71
- country: string;
72
- city?: string | undefined;
73
- region?: string | undefined;
74
- timezone?: string | undefined;
75
- } | undefined;
76
- }, {
77
- maxUses?: number | undefined;
78
- allowedDomains?: string[] | undefined;
79
- blockedDomains?: string[] | undefined;
80
- userLocation?: {
81
- type: "approximate";
82
- country: string;
83
- city?: string | undefined;
84
- region?: string | undefined;
85
- timezone?: string | undefined;
86
- } | undefined;
87
- }>>;
88
- }, "strip", z.ZodTypeAny, {
89
- sendReasoning?: boolean | undefined;
90
- thinking?: {
91
- type: "enabled" | "disabled";
92
- budgetTokens?: number | undefined;
93
- } | undefined;
94
- webSearch?: {
95
- maxUses?: number | undefined;
96
- allowedDomains?: string[] | undefined;
97
- blockedDomains?: string[] | undefined;
98
- userLocation?: {
99
- type: "approximate";
100
- country: string;
101
- city?: string | undefined;
102
- region?: string | undefined;
103
- timezone?: string | undefined;
104
- } | undefined;
105
- } | undefined;
106
- }, {
107
- sendReasoning?: boolean | undefined;
108
- thinking?: {
109
- type: "enabled" | "disabled";
110
- budgetTokens?: number | undefined;
111
- } | undefined;
112
- webSearch?: {
113
- maxUses?: number | undefined;
114
- allowedDomains?: string[] | undefined;
115
- blockedDomains?: string[] | undefined;
116
- userLocation?: {
117
- type: "approximate";
118
- country: string;
119
- city?: string | undefined;
120
- region?: string | undefined;
121
- timezone?: string | undefined;
122
- } | undefined;
123
- } | undefined;
124
- }>;
12
+ }, z.core.$strip>>;
13
+ disableParallelToolUse: z.ZodOptional<z.ZodBoolean>;
14
+ }, z.core.$strip>;
125
15
  type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
126
16
 
127
- type ExecuteFunction<PARAMETERS, RESULT> = undefined | ((args: PARAMETERS, options: {
128
- abortSignal?: AbortSignal;
129
- }) => Promise<RESULT>);
130
- declare const Bash20241022Parameters: z.ZodObject<{
131
- command: z.ZodString;
132
- restart: z.ZodOptional<z.ZodBoolean>;
133
- }, "strip", z.ZodTypeAny, {
134
- command: string;
135
- restart?: boolean | undefined;
136
- }, {
137
- command: string;
138
- restart?: boolean | undefined;
139
- }>;
140
- /**
141
- * Creates a tool for running a bash command. Must have name "bash".
142
- *
143
- * Image results are supported.
144
- *
145
- * @param execute - The function to execute the tool. Optional.
146
- */
147
- declare function bashTool_20241022<RESULT>(options?: {
148
- execute?: ExecuteFunction<{
149
- /**
150
- * The bash command to run. Required unless the tool is being restarted.
151
- */
17
+ declare const anthropicTools: {
18
+ /**
19
+ * Creates a tool for running a bash command. Must have name "bash".
20
+ *
21
+ * Image results are supported.
22
+ *
23
+ * @param execute - The function to execute the tool. Optional.
24
+ */
25
+ bash_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
152
26
  command: string;
153
- /**
154
- * Specifying true will restart this tool. Otherwise, leave this unspecified.
155
- */
156
27
  restart?: boolean;
157
- }, RESULT>;
158
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
159
- }): {
160
- type: 'provider-defined';
161
- id: 'anthropic.bash_20241022';
162
- args: {};
163
- parameters: typeof Bash20241022Parameters;
164
- execute: ExecuteFunction<z.infer<typeof Bash20241022Parameters>, RESULT>;
165
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
166
- };
167
- declare const Bash20250124Parameters: z.ZodObject<{
168
- command: z.ZodString;
169
- restart: z.ZodOptional<z.ZodBoolean>;
170
- }, "strip", z.ZodTypeAny, {
171
- command: string;
172
- restart?: boolean | undefined;
173
- }, {
174
- command: string;
175
- restart?: boolean | undefined;
176
- }>;
177
- /**
178
- * Creates a tool for running a bash command. Must have name "bash".
179
- *
180
- * Image results are supported.
181
- *
182
- * @param execute - The function to execute the tool. Optional.
183
- */
184
- declare function bashTool_20250124<RESULT>(options?: {
185
- execute?: ExecuteFunction<{
186
- /**
187
- * The bash command to run. Required unless the tool is being restarted.
188
- */
28
+ }, {}>;
29
+ /**
30
+ * Creates a tool for running a bash command. Must have name "bash".
31
+ *
32
+ * Image results are supported.
33
+ *
34
+ * @param execute - The function to execute the tool. Optional.
35
+ */
36
+ bash_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
189
37
  command: string;
190
- /**
191
- * Specifying true will restart this tool. Otherwise, leave this unspecified.
192
- */
193
38
  restart?: boolean;
194
- }, RESULT>;
195
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
196
- }): {
197
- type: 'provider-defined';
198
- id: 'anthropic.bash_20250124';
199
- args: {};
200
- parameters: typeof Bash20250124Parameters;
201
- execute: ExecuteFunction<z.infer<typeof Bash20250124Parameters>, RESULT>;
202
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
203
- };
204
- declare const TextEditor20241022Parameters: z.ZodObject<{
205
- command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
206
- path: z.ZodString;
207
- file_text: z.ZodOptional<z.ZodString>;
208
- insert_line: z.ZodOptional<z.ZodNumber>;
209
- new_str: z.ZodOptional<z.ZodString>;
210
- old_str: z.ZodOptional<z.ZodString>;
211
- view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
212
- }, "strip", z.ZodTypeAny, {
213
- path: string;
214
- command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
215
- file_text?: string | undefined;
216
- insert_line?: number | undefined;
217
- new_str?: string | undefined;
218
- old_str?: string | undefined;
219
- view_range?: number[] | undefined;
220
- }, {
221
- path: string;
222
- command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
223
- file_text?: string | undefined;
224
- insert_line?: number | undefined;
225
- new_str?: string | undefined;
226
- old_str?: string | undefined;
227
- view_range?: number[] | undefined;
228
- }>;
229
- /**
230
- * Creates a tool for editing text. Must have name "str_replace_editor".
231
- *
232
- * Image results are supported.
233
- *
234
- * @param execute - The function to execute the tool. Optional.
235
- */
236
- declare function textEditorTool_20241022<RESULT>(options?: {
237
- execute?: ExecuteFunction<{
238
- /**
239
- * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
240
- */
241
- command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
242
- /**
243
- * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
244
- */
39
+ }, {}>;
40
+ /**
41
+ * Creates a tool for editing text. Must have name "str_replace_editor".
42
+ */
43
+ textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
44
+ command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
245
45
  path: string;
246
- /**
247
- * Required parameter of `create` command, with the content of the file to be created.
248
- */
249
46
  file_text?: string;
250
- /**
251
- * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
252
- */
253
47
  insert_line?: number;
254
- /**
255
- * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.
256
- */
257
48
  new_str?: string;
258
- /**
259
- * Required parameter of `str_replace` command containing the string in `path` to replace.
260
- */
261
49
  old_str?: string;
262
- /**
263
- * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.
264
- */
265
50
  view_range?: number[];
266
- }, RESULT>;
267
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
268
- }): {
269
- type: 'provider-defined';
270
- id: 'anthropic.text_editor_20241022';
271
- args: {};
272
- parameters: typeof TextEditor20241022Parameters;
273
- execute: ExecuteFunction<z.infer<typeof TextEditor20241022Parameters>, RESULT>;
274
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
275
- };
276
- declare const TextEditor20250124Parameters: z.ZodObject<{
277
- command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
278
- path: z.ZodString;
279
- file_text: z.ZodOptional<z.ZodString>;
280
- insert_line: z.ZodOptional<z.ZodNumber>;
281
- new_str: z.ZodOptional<z.ZodString>;
282
- old_str: z.ZodOptional<z.ZodString>;
283
- view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
284
- }, "strip", z.ZodTypeAny, {
285
- path: string;
286
- command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
287
- file_text?: string | undefined;
288
- insert_line?: number | undefined;
289
- new_str?: string | undefined;
290
- old_str?: string | undefined;
291
- view_range?: number[] | undefined;
292
- }, {
293
- path: string;
294
- command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
295
- file_text?: string | undefined;
296
- insert_line?: number | undefined;
297
- new_str?: string | undefined;
298
- old_str?: string | undefined;
299
- view_range?: number[] | undefined;
300
- }>;
301
- /**
302
- * Creates a tool for editing text. Must have name "str_replace_editor".
303
- *
304
- * Image results are supported.
305
- *
306
- * @param execute - The function to execute the tool. Optional.
307
- */
308
- declare function textEditorTool_20250124<RESULT>(options?: {
309
- execute?: ExecuteFunction<{
310
- /**
311
- * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
312
- */
313
- command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
314
- /**
315
- * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
316
- */
51
+ }, {}>;
52
+ /**
53
+ * Creates a tool for editing text. Must have name "str_replace_editor".
54
+ */
55
+ textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
56
+ command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
317
57
  path: string;
318
- /**
319
- * Required parameter of `create` command, with the content of the file to be created.
320
- */
321
58
  file_text?: string;
322
- /**
323
- * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
324
- */
325
59
  insert_line?: number;
326
- /**
327
- * Optional parameter of `str_replace` command containing the new string (if not given, no string will be added). Required parameter of `insert` command containing the string to insert.
328
- */
329
60
  new_str?: string;
330
- /**
331
- * Required parameter of `str_replace` command containing the string in `path` to replace.
332
- */
333
61
  old_str?: string;
334
- /**
335
- * Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.
336
- */
337
62
  view_range?: number[];
338
- }, RESULT>;
339
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
340
- }): {
341
- type: 'provider-defined';
342
- id: 'anthropic.text_editor_20250124';
343
- args: {};
344
- parameters: typeof TextEditor20250124Parameters;
345
- execute: ExecuteFunction<z.infer<typeof TextEditor20250124Parameters>, RESULT>;
346
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
347
- };
348
- declare const Computer20241022Parameters: z.ZodObject<{
349
- action: z.ZodEnum<["key", "type", "mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "screenshot", "cursor_position"]>;
350
- coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
351
- text: z.ZodOptional<z.ZodString>;
352
- }, "strip", z.ZodTypeAny, {
353
- action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
354
- text?: string | undefined;
355
- coordinate?: number[] | undefined;
356
- }, {
357
- action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
358
- text?: string | undefined;
359
- coordinate?: number[] | undefined;
360
- }>;
361
- /**
362
- * Creates a tool for executing actions on a computer. Must have name "computer".
363
- *
364
- * Image results are supported.
365
- *
366
- * @param displayWidthPx - The width of the display being controlled by the model in pixels.
367
- * @param displayHeightPx - The height of the display being controlled by the model in pixels.
368
- * @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.
369
- * @param execute - The function to execute the tool. Optional.
370
- */
371
- declare function computerTool_20241022<RESULT>(options: {
372
- displayWidthPx: number;
373
- displayHeightPx: number;
374
- displayNumber?: number;
375
- execute?: ExecuteFunction<{
376
- /**
377
- * The action to perform. The available actions are:
378
- * - `key`: Press a key or key-combination on the keyboard.
379
- * - This supports xdotool's `key` syntax.
380
- * - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
381
- * - `type`: Type a string of text on the keyboard.
382
- * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
383
- * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
384
- * - `left_click`: Click the left mouse button.
385
- * - `left_click_drag`: Click and drag the cursor to a specified (x, y) pixel coordinate on the screen.
386
- * - `right_click`: Click the right mouse button.
387
- * - `middle_click`: Click the middle mouse button.
388
- * - `double_click`: Double-click the left mouse button.
389
- * - `screenshot`: Take a screenshot of the screen.
390
- */
391
- action: 'key' | 'type' | 'mouse_move' | 'left_click' | 'left_click_drag' | 'right_click' | 'middle_click' | 'double_click' | 'screenshot' | 'cursor_position';
392
- /**
393
- * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.
394
- */
63
+ }, {}>;
64
+ /**
65
+ * Creates a tool for editing text. Must have name "str_replace_based_edit_tool".
66
+ * Note: This version does not support the "undo_edit" command.
67
+ */
68
+ textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
69
+ command: "view" | "create" | "str_replace" | "insert";
70
+ path: string;
71
+ file_text?: string;
72
+ insert_line?: number;
73
+ new_str?: string;
74
+ old_str?: string;
75
+ view_range?: number[];
76
+ }, {}>;
77
+ /**
78
+ * Creates a tool for executing actions on a computer. Must have name "computer".
79
+ *
80
+ * Image results are supported.
81
+ *
82
+ * @param displayWidthPx - The width of the display being controlled by the model in pixels.
83
+ * @param displayHeightPx - The height of the display being controlled by the model in pixels.
84
+ * @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.
85
+ */
86
+ computer_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
87
+ action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
395
88
  coordinate?: number[];
396
- /**
397
- * Required only by `action=type` and `action=key`.
398
- */
399
89
  text?: string;
400
- }, RESULT>;
401
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
402
- }): {
403
- type: 'provider-defined';
404
- id: 'anthropic.computer_20241022';
405
- args: {};
406
- parameters: typeof Computer20241022Parameters;
407
- execute: ExecuteFunction<z.infer<typeof Computer20241022Parameters>, RESULT>;
408
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
409
- };
410
- declare const Computer20250124Parameters: z.ZodObject<{
411
- action: z.ZodEnum<["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"]>;
412
- coordinate: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
413
- duration: z.ZodOptional<z.ZodNumber>;
414
- scroll_amount: z.ZodOptional<z.ZodNumber>;
415
- scroll_direction: z.ZodOptional<z.ZodEnum<["up", "down", "left", "right"]>>;
416
- start_coordinate: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
417
- text: z.ZodOptional<z.ZodString>;
418
- }, "strip", z.ZodTypeAny, {
419
- action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position" | "hold_key" | "left_mouse_down" | "left_mouse_up" | "triple_click" | "scroll" | "wait";
420
- text?: string | undefined;
421
- coordinate?: [number, number] | undefined;
422
- duration?: number | undefined;
423
- scroll_amount?: number | undefined;
424
- scroll_direction?: "up" | "down" | "left" | "right" | undefined;
425
- start_coordinate?: [number, number] | undefined;
426
- }, {
427
- action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position" | "hold_key" | "left_mouse_down" | "left_mouse_up" | "triple_click" | "scroll" | "wait";
428
- text?: string | undefined;
429
- coordinate?: [number, number] | undefined;
430
- duration?: number | undefined;
431
- scroll_amount?: number | undefined;
432
- scroll_direction?: "up" | "down" | "left" | "right" | undefined;
433
- start_coordinate?: [number, number] | undefined;
434
- }>;
435
- /**
436
- * Creates a tool for executing actions on a computer. Must have name "computer".
437
- *
438
- * Image results are supported.
439
- *
440
- * @param displayWidthPx - The width of the display being controlled by the model in pixels.
441
- * @param displayHeightPx - The height of the display being controlled by the model in pixels.
442
- * @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.
443
- * @param execute - The function to execute the tool. Optional.
444
- */
445
- declare function computerTool_20250124<RESULT>(options: {
446
- displayWidthPx: number;
447
- displayHeightPx: number;
448
- displayNumber?: number;
449
- execute?: ExecuteFunction<{
450
- /**
451
- * - `key`: Press a key or key-combination on the keyboard.
452
- * - This supports xdotool's `key` syntax.
453
- * - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
454
- * - `hold_key`: Hold down a key or multiple keys for a specified duration (in seconds). Supports the same syntax as `key`.
455
- * - `type`: Type a string of text on the keyboard.
456
- * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
457
- * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
458
- * - `left_mouse_down`: Press the left mouse button.
459
- * - `left_mouse_up`: Release the left mouse button.
460
- * - `left_click`: Click the left mouse button at the specified (x, y) pixel coordinate on the screen. You can also include a key combination to hold down while clicking using the `text` parameter.
461
- * - `left_click_drag`: Click and drag the cursor from `start_coordinate` to a specified (x, y) pixel coordinate on the screen.
462
- * - `right_click`: Click the right mouse button at the specified (x, y) pixel coordinate on the screen.
463
- * - `middle_click`: Click the middle mouse button at the specified (x, y) pixel coordinate on the screen.
464
- * - `double_click`: Double-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
465
- * - `triple_click`: Triple-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
466
- * - `scroll`: Scroll the screen in a specified direction by a specified amount of clicks of the scroll wheel, at the specified (x, y) pixel coordinate. DO NOT use PageUp/PageDown to scroll.
467
- * - `wait`: Wait for a specified duration (in seconds).
468
- * - `screenshot`: Take a screenshot of the screen.
469
- */
470
- 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';
471
- /**
472
- * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to move the mouse to. Required only by `action=mouse_move` and `action=left_click_drag`.
473
- */
90
+ }, {
91
+ displayWidthPx: number;
92
+ displayHeightPx: number;
93
+ displayNumber?: number;
94
+ }>;
95
+ /**
96
+ * Creates a tool for executing actions on a computer. Must have name "computer".
97
+ *
98
+ * Image results are supported.
99
+ *
100
+ * @param displayWidthPx - The width of the display being controlled by the model in pixels.
101
+ * @param displayHeightPx - The height of the display being controlled by the model in pixels.
102
+ * @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.
103
+ * @param execute - The function to execute the tool. Optional.
104
+ */
105
+ computer_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
106
+ 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";
474
107
  coordinate?: [number, number];
475
- /**
476
- * The duration to hold the key down for. Required only by `action=hold_key` and `action=wait`.
477
- */
478
108
  duration?: number;
479
- /**
480
- * The number of 'clicks' to scroll. Required only by `action=scroll`.
481
- */
482
109
  scroll_amount?: number;
483
- /**
484
- * The direction to scroll the screen. Required only by `action=scroll`.
485
- */
486
- scroll_direction?: 'up' | 'down' | 'left' | 'right';
487
- /**
488
- * (x, y): The x (pixels from the left edge) and y (pixels from the top edge) coordinates to start the drag from. Required only by `action=left_click_drag`.
489
- */
110
+ scroll_direction?: "up" | "down" | "left" | "right";
490
111
  start_coordinate?: [number, number];
491
- /**
492
- * Required only by `action=type`, `action=key`, and `action=hold_key`. Can also be used by click or scroll actions to hold down keys while clicking or scrolling.
493
- */
494
112
  text?: string;
495
- }, RESULT>;
496
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
497
- }): {
498
- type: 'provider-defined';
499
- id: 'anthropic.computer_20250124';
500
- args: {};
501
- parameters: typeof Computer20250124Parameters;
502
- execute: ExecuteFunction<z.infer<typeof Computer20250124Parameters>, RESULT>;
503
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
504
- };
505
- declare const anthropicTools: {
506
- bash_20241022: typeof bashTool_20241022;
507
- bash_20250124: typeof bashTool_20250124;
508
- textEditor_20241022: typeof textEditorTool_20241022;
509
- textEditor_20250124: typeof textEditorTool_20250124;
510
- computer_20241022: typeof computerTool_20241022;
511
- computer_20250124: typeof computerTool_20250124;
113
+ }, {
114
+ displayWidthPx: number;
115
+ displayHeightPx: number;
116
+ displayNumber?: number;
117
+ }>;
118
+ /**
119
+ * Creates a web search tool that gives Claude direct access to real-time web content.
120
+ * Must have name "web_search".
121
+ *
122
+ * @param maxUses - Maximum number of web searches Claude can perform during the conversation.
123
+ * @param allowedDomains - Optional list of domains that Claude is allowed to search.
124
+ * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
125
+ * @param userLocation - Optional user location information to provide geographically relevant search results.
126
+ */
127
+ webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
128
+ query: string;
129
+ }, {
130
+ url: string;
131
+ title: string;
132
+ pageAge: string | null;
133
+ encryptedContent: string;
134
+ type: string;
135
+ }[], {
136
+ maxUses?: number;
137
+ allowedDomains?: string[];
138
+ blockedDomains?: string[];
139
+ userLocation?: {
140
+ type: "approximate";
141
+ city?: string;
142
+ region?: string;
143
+ country?: string;
144
+ timezone?: string;
145
+ };
146
+ }>>[0]) => _ai_sdk_provider_utils.Tool<{
147
+ query: string;
148
+ }, {
149
+ url: string;
150
+ title: string;
151
+ pageAge: string | null;
152
+ encryptedContent: string;
153
+ type: string;
154
+ }[]>;
512
155
  };
513
156
 
514
157
  interface AnthropicProvider extends ProviderV2 {