@ai-sdk/anthropic 2.0.0-alpha.8 → 2.0.0-beta.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 CHANGED
@@ -1,5 +1,99 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 2.0.0-beta.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8f2854f: feat (provider/anthropic): send web search tool calls
8
+ - 5d959e7: refactor: updated openai + anthropic tool use server side
9
+ - 9f73965: feat (provider/anthropic): parse websearch tool args
10
+ - 399e056: fix: anthropic computer tool
11
+ - Updated dependencies [742b7be]
12
+ - Updated dependencies [7cddb72]
13
+ - Updated dependencies [ccce59b]
14
+ - Updated dependencies [e2b9e4b]
15
+ - Updated dependencies [45c1ea2]
16
+ - Updated dependencies [e025824]
17
+ - Updated dependencies [0d06df6]
18
+ - Updated dependencies [472524a]
19
+ - Updated dependencies [dd3ff01]
20
+ - Updated dependencies [7435eb5]
21
+ - Updated dependencies [cb68df0]
22
+ - Updated dependencies [bfdca8d]
23
+ - Updated dependencies [44f4aba]
24
+ - Updated dependencies [023ba40]
25
+ - Updated dependencies [5e57fae]
26
+ - Updated dependencies [71f938d]
27
+ - Updated dependencies [28a5ed5]
28
+ - @ai-sdk/provider@2.0.0-beta.1
29
+ - @ai-sdk/provider-utils@3.0.0-beta.1
30
+
31
+ ## 2.0.0-alpha.15
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [48d257a]
36
+ - Updated dependencies [8ba77a7]
37
+ - @ai-sdk/provider@2.0.0-alpha.15
38
+ - @ai-sdk/provider-utils@3.0.0-alpha.15
39
+
40
+ ## 2.0.0-alpha.14
41
+
42
+ ### Patch Changes
43
+
44
+ - 2e13791: feat(anthropic): add server-side web search support
45
+ - 6392f60: fix(anthropic): resolve web search API validation errors with partial location + provider output
46
+ - Updated dependencies [b5da06a]
47
+ - Updated dependencies [63f9e9b]
48
+ - Updated dependencies [2e13791]
49
+ - @ai-sdk/provider@2.0.0-alpha.14
50
+ - @ai-sdk/provider-utils@3.0.0-alpha.14
51
+
52
+ ## 2.0.0-alpha.13
53
+
54
+ ### Patch Changes
55
+
56
+ - 8dfcb11: feat(anthropic/citation): text support for citations
57
+ - ee5a9c0: feat: streamText onChunk raw chunk support
58
+ - Updated dependencies [68ecf2f]
59
+ - @ai-sdk/provider@2.0.0-alpha.13
60
+ - @ai-sdk/provider-utils@3.0.0-alpha.13
61
+
62
+ ## 2.0.0-alpha.12
63
+
64
+ ### Patch Changes
65
+
66
+ - e2aceaf: feat: add raw chunk support
67
+ - Updated dependencies [e2aceaf]
68
+ - @ai-sdk/provider@2.0.0-alpha.12
69
+ - @ai-sdk/provider-utils@3.0.0-alpha.12
70
+
71
+ ## 2.0.0-alpha.11
72
+
73
+ ### Patch Changes
74
+
75
+ - 25f3454: feat(provider/anthropic): add PDF citation support with document sources for streamText
76
+ - Updated dependencies [c1e6647]
77
+ - @ai-sdk/provider@2.0.0-alpha.11
78
+ - @ai-sdk/provider-utils@3.0.0-alpha.11
79
+
80
+ ## 2.0.0-alpha.10
81
+
82
+ ### Patch Changes
83
+
84
+ - Updated dependencies [c4df419]
85
+ - @ai-sdk/provider@2.0.0-alpha.10
86
+ - @ai-sdk/provider-utils@3.0.0-alpha.10
87
+
88
+ ## 2.0.0-alpha.9
89
+
90
+ ### Patch Changes
91
+
92
+ - 362b048: add web search tool support
93
+ - Updated dependencies [811dff3]
94
+ - @ai-sdk/provider@2.0.0-alpha.9
95
+ - @ai-sdk/provider-utils@3.0.0-alpha.9
96
+
3
97
  ## 2.0.0-alpha.8
4
98
 
5
99
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,14 +1,10 @@
1
1
  import { z } from 'zod';
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
6
  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
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
10
  type: z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>;
@@ -35,391 +31,131 @@ declare const anthropicProviderOptions: z.ZodObject<{
35
31
  }>;
36
32
  type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
37
33
 
38
- type ExecuteFunction<PARAMETERS, RESULT> = undefined | ((args: PARAMETERS, options: {
39
- abortSignal?: AbortSignal;
40
- }) => Promise<RESULT>);
41
- declare const Bash20241022Parameters: z.ZodObject<{
42
- command: z.ZodString;
43
- restart: z.ZodOptional<z.ZodBoolean>;
44
- }, "strip", z.ZodTypeAny, {
45
- command: string;
46
- restart?: boolean | undefined;
47
- }, {
48
- command: string;
49
- restart?: boolean | undefined;
50
- }>;
51
- /**
52
- * Creates a tool for running a bash command. Must have name "bash".
53
- *
54
- * Image results are supported.
55
- *
56
- * @param execute - The function to execute the tool. Optional.
57
- */
58
- declare function bashTool_20241022<RESULT>(options?: {
59
- execute?: ExecuteFunction<{
60
- /**
61
- * The bash command to run. Required unless the tool is being restarted.
62
- */
34
+ declare const anthropicTools: {
35
+ /**
36
+ * Creates a tool for running a bash command. Must have name "bash".
37
+ *
38
+ * Image results are supported.
39
+ *
40
+ * @param execute - The function to execute the tool. Optional.
41
+ */
42
+ bash_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
63
43
  command: string;
64
- /**
65
- * Specifying true will restart this tool. Otherwise, leave this unspecified.
66
- */
67
44
  restart?: boolean;
68
- }, RESULT>;
69
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
70
- }): {
71
- type: 'provider-defined';
72
- id: 'anthropic.bash_20241022';
73
- args: {};
74
- parameters: typeof Bash20241022Parameters;
75
- execute: ExecuteFunction<z.infer<typeof Bash20241022Parameters>, RESULT>;
76
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
77
- };
78
- declare const Bash20250124Parameters: z.ZodObject<{
79
- command: z.ZodString;
80
- restart: z.ZodOptional<z.ZodBoolean>;
81
- }, "strip", z.ZodTypeAny, {
82
- command: string;
83
- restart?: boolean | undefined;
84
- }, {
85
- command: string;
86
- restart?: boolean | undefined;
87
- }>;
88
- /**
89
- * Creates a tool for running a bash command. Must have name "bash".
90
- *
91
- * Image results are supported.
92
- *
93
- * @param execute - The function to execute the tool. Optional.
94
- */
95
- declare function bashTool_20250124<RESULT>(options?: {
96
- execute?: ExecuteFunction<{
97
- /**
98
- * The bash command to run. Required unless the tool is being restarted.
99
- */
45
+ }, {}>;
46
+ /**
47
+ * Creates a tool for running a bash command. Must have name "bash".
48
+ *
49
+ * Image results are supported.
50
+ *
51
+ * @param execute - The function to execute the tool. Optional.
52
+ */
53
+ bash_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
100
54
  command: string;
101
- /**
102
- * Specifying true will restart this tool. Otherwise, leave this unspecified.
103
- */
104
55
  restart?: boolean;
105
- }, RESULT>;
106
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
107
- }): {
108
- type: 'provider-defined';
109
- id: 'anthropic.bash_20250124';
110
- args: {};
111
- parameters: typeof Bash20250124Parameters;
112
- execute: ExecuteFunction<z.infer<typeof Bash20250124Parameters>, RESULT>;
113
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
114
- };
115
- declare const TextEditor20241022Parameters: z.ZodObject<{
116
- command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
117
- path: z.ZodString;
118
- file_text: z.ZodOptional<z.ZodString>;
119
- insert_line: z.ZodOptional<z.ZodNumber>;
120
- new_str: z.ZodOptional<z.ZodString>;
121
- old_str: z.ZodOptional<z.ZodString>;
122
- view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
123
- }, "strip", z.ZodTypeAny, {
124
- path: string;
125
- command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
126
- file_text?: string | undefined;
127
- insert_line?: number | undefined;
128
- new_str?: string | undefined;
129
- old_str?: string | undefined;
130
- view_range?: number[] | undefined;
131
- }, {
132
- path: string;
133
- command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
134
- file_text?: string | undefined;
135
- insert_line?: number | undefined;
136
- new_str?: string | undefined;
137
- old_str?: string | undefined;
138
- view_range?: number[] | undefined;
139
- }>;
140
- /**
141
- * Creates a tool for editing text. Must have name "str_replace_editor".
142
- *
143
- * Image results are supported.
144
- *
145
- * @param execute - The function to execute the tool. Optional.
146
- */
147
- declare function textEditorTool_20241022<RESULT>(options?: {
148
- execute?: ExecuteFunction<{
149
- /**
150
- * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
151
- */
152
- command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
153
- /**
154
- * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
155
- */
56
+ }, {}>;
57
+ /**
58
+ * Creates a tool for editing text. Must have name "str_replace_editor".
59
+ */
60
+ textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
61
+ command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
156
62
  path: string;
157
- /**
158
- * Required parameter of `create` command, with the content of the file to be created.
159
- */
160
63
  file_text?: string;
161
- /**
162
- * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
163
- */
164
64
  insert_line?: number;
165
- /**
166
- * 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.
167
- */
168
65
  new_str?: string;
169
- /**
170
- * Required parameter of `str_replace` command containing the string in `path` to replace.
171
- */
172
66
  old_str?: string;
173
- /**
174
- * 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.
175
- */
176
67
  view_range?: number[];
177
- }, RESULT>;
178
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
179
- }): {
180
- type: 'provider-defined';
181
- id: 'anthropic.text_editor_20241022';
182
- args: {};
183
- parameters: typeof TextEditor20241022Parameters;
184
- execute: ExecuteFunction<z.infer<typeof TextEditor20241022Parameters>, RESULT>;
185
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
186
- };
187
- declare const TextEditor20250124Parameters: z.ZodObject<{
188
- command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
189
- path: z.ZodString;
190
- file_text: z.ZodOptional<z.ZodString>;
191
- insert_line: z.ZodOptional<z.ZodNumber>;
192
- new_str: z.ZodOptional<z.ZodString>;
193
- old_str: z.ZodOptional<z.ZodString>;
194
- view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
195
- }, "strip", z.ZodTypeAny, {
196
- path: string;
197
- command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
198
- file_text?: string | undefined;
199
- insert_line?: number | undefined;
200
- new_str?: string | undefined;
201
- old_str?: string | undefined;
202
- view_range?: number[] | undefined;
203
- }, {
204
- path: string;
205
- command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
206
- file_text?: string | undefined;
207
- insert_line?: number | undefined;
208
- new_str?: string | undefined;
209
- old_str?: string | undefined;
210
- view_range?: number[] | undefined;
211
- }>;
212
- /**
213
- * Creates a tool for editing text. Must have name "str_replace_editor".
214
- *
215
- * Image results are supported.
216
- *
217
- * @param execute - The function to execute the tool. Optional.
218
- */
219
- declare function textEditorTool_20250124<RESULT>(options?: {
220
- execute?: ExecuteFunction<{
221
- /**
222
- * The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
223
- */
224
- command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
225
- /**
226
- * Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
227
- */
68
+ }, {}>;
69
+ /**
70
+ * Creates a tool for editing text. Must have name "str_replace_editor".
71
+ */
72
+ textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
73
+ command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
228
74
  path: string;
229
- /**
230
- * Required parameter of `create` command, with the content of the file to be created.
231
- */
232
75
  file_text?: string;
233
- /**
234
- * Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
235
- */
236
76
  insert_line?: number;
237
- /**
238
- * 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.
239
- */
240
77
  new_str?: string;
241
- /**
242
- * Required parameter of `str_replace` command containing the string in `path` to replace.
243
- */
244
78
  old_str?: string;
245
- /**
246
- * 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.
247
- */
248
79
  view_range?: number[];
249
- }, RESULT>;
250
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
251
- }): {
252
- type: 'provider-defined';
253
- id: 'anthropic.text_editor_20250124';
254
- args: {};
255
- parameters: typeof TextEditor20250124Parameters;
256
- execute: ExecuteFunction<z.infer<typeof TextEditor20250124Parameters>, RESULT>;
257
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
258
- };
259
- declare const Computer20241022Parameters: z.ZodObject<{
260
- action: z.ZodEnum<["key", "type", "mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "screenshot", "cursor_position"]>;
261
- coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
262
- text: z.ZodOptional<z.ZodString>;
263
- }, "strip", z.ZodTypeAny, {
264
- action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
265
- text?: string | undefined;
266
- coordinate?: number[] | undefined;
267
- }, {
268
- action: "type" | "key" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
269
- text?: string | undefined;
270
- coordinate?: number[] | undefined;
271
- }>;
272
- /**
273
- * Creates a tool for executing actions on a computer. Must have name "computer".
274
- *
275
- * Image results are supported.
276
- *
277
- * @param displayWidthPx - The width of the display being controlled by the model in pixels.
278
- * @param displayHeightPx - The height of the display being controlled by the model in pixels.
279
- * @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.
280
- * @param execute - The function to execute the tool. Optional.
281
- */
282
- declare function computerTool_20241022<RESULT>(options: {
283
- displayWidthPx: number;
284
- displayHeightPx: number;
285
- displayNumber?: number;
286
- execute?: ExecuteFunction<{
287
- /**
288
- * The action to perform. The available actions are:
289
- * - `key`: Press a key or key-combination on the keyboard.
290
- * - This supports xdotool's `key` syntax.
291
- * - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
292
- * - `type`: Type a string of text on the keyboard.
293
- * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
294
- * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
295
- * - `left_click`: Click the left mouse button.
296
- * - `left_click_drag`: Click and drag the cursor to a specified (x, y) pixel coordinate on the screen.
297
- * - `right_click`: Click the right mouse button.
298
- * - `middle_click`: Click the middle mouse button.
299
- * - `double_click`: Double-click the left mouse button.
300
- * - `screenshot`: Take a screenshot of the screen.
301
- */
302
- action: 'key' | 'type' | 'mouse_move' | 'left_click' | 'left_click_drag' | 'right_click' | 'middle_click' | 'double_click' | 'screenshot' | 'cursor_position';
303
- /**
304
- * (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`.
305
- */
80
+ }, {}>;
81
+ /**
82
+ * Creates a tool for executing actions on a computer. Must have name "computer".
83
+ *
84
+ * Image results are supported.
85
+ *
86
+ * @param displayWidthPx - The width of the display being controlled by the model in pixels.
87
+ * @param displayHeightPx - The height of the display being controlled by the model in pixels.
88
+ * @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.
89
+ */
90
+ computer_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
91
+ action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
306
92
  coordinate?: number[];
307
- /**
308
- * Required only by `action=type` and `action=key`.
309
- */
310
93
  text?: string;
311
- }, RESULT>;
312
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
313
- }): {
314
- type: 'provider-defined';
315
- id: 'anthropic.computer_20241022';
316
- args: {};
317
- parameters: typeof Computer20241022Parameters;
318
- execute: ExecuteFunction<z.infer<typeof Computer20241022Parameters>, RESULT>;
319
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
320
- };
321
- declare const Computer20250124Parameters: z.ZodObject<{
322
- 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"]>;
323
- coordinate: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
324
- duration: z.ZodOptional<z.ZodNumber>;
325
- scroll_amount: z.ZodOptional<z.ZodNumber>;
326
- scroll_direction: z.ZodOptional<z.ZodEnum<["up", "down", "left", "right"]>>;
327
- start_coordinate: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
328
- text: z.ZodOptional<z.ZodString>;
329
- }, "strip", z.ZodTypeAny, {
330
- 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";
331
- text?: string | undefined;
332
- coordinate?: [number, number] | undefined;
333
- duration?: number | undefined;
334
- scroll_amount?: number | undefined;
335
- scroll_direction?: "up" | "down" | "left" | "right" | undefined;
336
- start_coordinate?: [number, number] | undefined;
337
- }, {
338
- 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";
339
- text?: string | undefined;
340
- coordinate?: [number, number] | undefined;
341
- duration?: number | undefined;
342
- scroll_amount?: number | undefined;
343
- scroll_direction?: "up" | "down" | "left" | "right" | undefined;
344
- start_coordinate?: [number, number] | undefined;
345
- }>;
346
- /**
347
- * Creates a tool for executing actions on a computer. Must have name "computer".
348
- *
349
- * Image results are supported.
350
- *
351
- * @param displayWidthPx - The width of the display being controlled by the model in pixels.
352
- * @param displayHeightPx - The height of the display being controlled by the model in pixels.
353
- * @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.
354
- * @param execute - The function to execute the tool. Optional.
355
- */
356
- declare function computerTool_20250124<RESULT>(options: {
357
- displayWidthPx: number;
358
- displayHeightPx: number;
359
- displayNumber?: number;
360
- execute?: ExecuteFunction<{
361
- /**
362
- * - `key`: Press a key or key-combination on the keyboard.
363
- * - This supports xdotool's `key` syntax.
364
- * - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
365
- * - `hold_key`: Hold down a key or multiple keys for a specified duration (in seconds). Supports the same syntax as `key`.
366
- * - `type`: Type a string of text on the keyboard.
367
- * - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
368
- * - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
369
- * - `left_mouse_down`: Press the left mouse button.
370
- * - `left_mouse_up`: Release the left mouse button.
371
- * - `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.
372
- * - `left_click_drag`: Click and drag the cursor from `start_coordinate` to a specified (x, y) pixel coordinate on the screen.
373
- * - `right_click`: Click the right mouse button at the specified (x, y) pixel coordinate on the screen.
374
- * - `middle_click`: Click the middle mouse button at the specified (x, y) pixel coordinate on the screen.
375
- * - `double_click`: Double-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
376
- * - `triple_click`: Triple-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
377
- * - `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.
378
- * - `wait`: Wait for a specified duration (in seconds).
379
- * - `screenshot`: Take a screenshot of the screen.
380
- */
381
- 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';
382
- /**
383
- * (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`.
384
- */
94
+ }, {
95
+ displayWidthPx: number;
96
+ displayHeightPx: number;
97
+ displayNumber?: number;
98
+ }>;
99
+ /**
100
+ * Creates a tool for executing actions on a computer. Must have name "computer".
101
+ *
102
+ * Image results are supported.
103
+ *
104
+ * @param displayWidthPx - The width of the display being controlled by the model in pixels.
105
+ * @param displayHeightPx - The height of the display being controlled by the model in pixels.
106
+ * @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.
107
+ * @param execute - The function to execute the tool. Optional.
108
+ */
109
+ computer_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
110
+ 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";
385
111
  coordinate?: [number, number];
386
- /**
387
- * The duration to hold the key down for. Required only by `action=hold_key` and `action=wait`.
388
- */
389
112
  duration?: number;
390
- /**
391
- * The number of 'clicks' to scroll. Required only by `action=scroll`.
392
- */
393
113
  scroll_amount?: number;
394
- /**
395
- * The direction to scroll the screen. Required only by `action=scroll`.
396
- */
397
- scroll_direction?: 'up' | 'down' | 'left' | 'right';
398
- /**
399
- * (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`.
400
- */
114
+ scroll_direction?: "up" | "down" | "left" | "right";
401
115
  start_coordinate?: [number, number];
402
- /**
403
- * 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.
404
- */
405
116
  text?: string;
406
- }, RESULT>;
407
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
408
- }): {
409
- type: 'provider-defined';
410
- id: 'anthropic.computer_20250124';
411
- args: {};
412
- parameters: typeof Computer20250124Parameters;
413
- execute: ExecuteFunction<z.infer<typeof Computer20250124Parameters>, RESULT>;
414
- experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
415
- };
416
- declare const anthropicTools: {
417
- bash_20241022: typeof bashTool_20241022;
418
- bash_20250124: typeof bashTool_20250124;
419
- textEditor_20241022: typeof textEditorTool_20241022;
420
- textEditor_20250124: typeof textEditorTool_20250124;
421
- computer_20241022: typeof computerTool_20241022;
422
- computer_20250124: typeof computerTool_20250124;
117
+ }, {
118
+ displayWidthPx: number;
119
+ displayHeightPx: number;
120
+ displayNumber?: number;
121
+ }>;
122
+ /**
123
+ * Creates a web search tool that gives Claude direct access to real-time web content.
124
+ * Must have name "web_search".
125
+ *
126
+ * @param maxUses - Maximum number of web searches Claude can perform during the conversation.
127
+ * @param allowedDomains - Optional list of domains that Claude is allowed to search.
128
+ * @param blockedDomains - Optional list of domains that Claude should avoid when searching.
129
+ * @param userLocation - Optional user location information to provide geographically relevant search results.
130
+ */
131
+ webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
132
+ query: string;
133
+ }, {
134
+ url: string;
135
+ title: string;
136
+ pageAge: string | null;
137
+ encryptedContent: string;
138
+ type: string;
139
+ }[], {
140
+ maxUses?: number;
141
+ allowedDomains?: string[];
142
+ blockedDomains?: string[];
143
+ userLocation?: {
144
+ type: "approximate";
145
+ city?: string;
146
+ region?: string;
147
+ country?: string;
148
+ timezone?: string;
149
+ };
150
+ }>>[0]) => _ai_sdk_provider_utils.Tool<{
151
+ query: string;
152
+ }, {
153
+ url: string;
154
+ title: string;
155
+ pageAge: string | null;
156
+ encryptedContent: string;
157
+ type: string;
158
+ }[]>;
423
159
  };
424
160
 
425
161
  interface AnthropicProvider extends ProviderV2 {