@ai-sdk/anthropic 2.0.0-canary.9 → 2.0.0
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 +481 -0
- package/README.md +2 -2
- package/dist/index.d.mts +129 -421
- package/dist/index.d.ts +129 -421
- package/dist/index.js +1173 -408
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1149 -392
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +178 -394
- package/dist/internal/index.d.ts +178 -394
- package/dist/internal/index.js +1159 -396
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1135 -382
- package/dist/internal/index.mjs.map +1 -1
- package/internal.d.ts +1 -0
- package/package.json +9 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,462 +1,170 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
2
|
import { ProviderV2, LanguageModelV2 } from '@ai-sdk/provider';
|
|
3
|
+
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
4
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
5
|
|
|
5
|
-
type AnthropicMessagesModelId = '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
|
-
|
|
8
|
-
Enable Anthropic cache control. This will allow you to use provider-specific
|
|
9
|
-
`cacheControl` metadata.
|
|
10
|
-
|
|
11
|
-
@deprecated cache control is now enabled by default (meaning you are able to
|
|
12
|
-
optionally mark content for caching) and this setting is no longer needed.
|
|
13
|
-
*/
|
|
14
|
-
cacheControl?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
Include reasoning content in requests sent to the model. Defaults to `true`.
|
|
17
|
-
|
|
18
|
-
If you are experiencing issues with the model handling requests involving
|
|
19
|
-
reasoning content, you can set this to `false` to omit them from the request.
|
|
20
|
-
*/
|
|
21
|
-
sendReasoning?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
declare const anthropicProviderOptionsSchema: z.ZodObject<{
|
|
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 & {});
|
|
7
|
+
declare const anthropicProviderOptions: z.ZodObject<{
|
|
8
|
+
sendReasoning: z.ZodOptional<z.ZodBoolean>;
|
|
25
9
|
thinking: z.ZodOptional<z.ZodObject<{
|
|
26
|
-
type: z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>;
|
|
10
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>;
|
|
27
11
|
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
type: "enabled" | "disabled";
|
|
33
|
-
budgetTokens?: number | undefined;
|
|
34
|
-
}>>;
|
|
35
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
thinking?: {
|
|
37
|
-
type: "enabled" | "disabled";
|
|
38
|
-
budgetTokens?: number | undefined;
|
|
39
|
-
} | undefined;
|
|
40
|
-
}, {
|
|
41
|
-
thinking?: {
|
|
42
|
-
type: "enabled" | "disabled";
|
|
43
|
-
budgetTokens?: number | undefined;
|
|
44
|
-
} | undefined;
|
|
45
|
-
}>;
|
|
46
|
-
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptionsSchema>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
disableParallelToolUse: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
47
16
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
mediaType?: string;
|
|
58
|
-
}>;
|
|
59
|
-
declare const Bash20241022Parameters: z.ZodObject<{
|
|
60
|
-
command: z.ZodString;
|
|
61
|
-
restart: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
-
}, "strip", z.ZodTypeAny, {
|
|
63
|
-
command: string;
|
|
64
|
-
restart?: boolean | undefined;
|
|
65
|
-
}, {
|
|
66
|
-
command: string;
|
|
67
|
-
restart?: boolean | undefined;
|
|
68
|
-
}>;
|
|
69
|
-
/**
|
|
70
|
-
* Creates a tool for running a bash command. Must have name "bash".
|
|
71
|
-
*
|
|
72
|
-
* Image results are supported.
|
|
73
|
-
*
|
|
74
|
-
* @param execute - The function to execute the tool. Optional.
|
|
75
|
-
*/
|
|
76
|
-
declare function bashTool_20241022<RESULT>(options?: {
|
|
77
|
-
execute?: ExecuteFunction<{
|
|
78
|
-
/**
|
|
79
|
-
* The bash command to run. Required unless the tool is being restarted.
|
|
80
|
-
*/
|
|
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<{
|
|
81
26
|
command: string;
|
|
82
|
-
/**
|
|
83
|
-
* Specifying true will restart this tool. Otherwise, leave this unspecified.
|
|
84
|
-
*/
|
|
85
27
|
restart?: boolean;
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
96
|
-
declare const Bash20250124Parameters: z.ZodObject<{
|
|
97
|
-
command: z.ZodString;
|
|
98
|
-
restart: z.ZodOptional<z.ZodBoolean>;
|
|
99
|
-
}, "strip", z.ZodTypeAny, {
|
|
100
|
-
command: string;
|
|
101
|
-
restart?: boolean | undefined;
|
|
102
|
-
}, {
|
|
103
|
-
command: string;
|
|
104
|
-
restart?: boolean | undefined;
|
|
105
|
-
}>;
|
|
106
|
-
/**
|
|
107
|
-
* Creates a tool for running a bash command. Must have name "bash".
|
|
108
|
-
*
|
|
109
|
-
* Image results are supported.
|
|
110
|
-
*
|
|
111
|
-
* @param execute - The function to execute the tool. Optional.
|
|
112
|
-
*/
|
|
113
|
-
declare function bashTool_20250124<RESULT>(options?: {
|
|
114
|
-
execute?: ExecuteFunction<{
|
|
115
|
-
/**
|
|
116
|
-
* The bash command to run. Required unless the tool is being restarted.
|
|
117
|
-
*/
|
|
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<{
|
|
118
37
|
command: string;
|
|
119
|
-
/**
|
|
120
|
-
* Specifying true will restart this tool. Otherwise, leave this unspecified.
|
|
121
|
-
*/
|
|
122
38
|
restart?: boolean;
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
parameters: typeof Bash20250124Parameters;
|
|
130
|
-
execute: ExecuteFunction<z.infer<typeof Bash20250124Parameters>, RESULT>;
|
|
131
|
-
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
132
|
-
};
|
|
133
|
-
declare const TextEditor20241022Parameters: z.ZodObject<{
|
|
134
|
-
command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
|
|
135
|
-
path: z.ZodString;
|
|
136
|
-
file_text: z.ZodOptional<z.ZodString>;
|
|
137
|
-
insert_line: z.ZodOptional<z.ZodNumber>;
|
|
138
|
-
new_str: z.ZodOptional<z.ZodString>;
|
|
139
|
-
old_str: z.ZodOptional<z.ZodString>;
|
|
140
|
-
view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
141
|
-
}, "strip", z.ZodTypeAny, {
|
|
142
|
-
path: string;
|
|
143
|
-
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
144
|
-
file_text?: string | undefined;
|
|
145
|
-
insert_line?: number | undefined;
|
|
146
|
-
new_str?: string | undefined;
|
|
147
|
-
old_str?: string | undefined;
|
|
148
|
-
view_range?: number[] | undefined;
|
|
149
|
-
}, {
|
|
150
|
-
path: string;
|
|
151
|
-
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
152
|
-
file_text?: string | undefined;
|
|
153
|
-
insert_line?: number | undefined;
|
|
154
|
-
new_str?: string | undefined;
|
|
155
|
-
old_str?: string | undefined;
|
|
156
|
-
view_range?: number[] | undefined;
|
|
157
|
-
}>;
|
|
158
|
-
/**
|
|
159
|
-
* Creates a tool for editing text. Must have name "str_replace_editor".
|
|
160
|
-
*
|
|
161
|
-
* Image results are supported.
|
|
162
|
-
*
|
|
163
|
-
* @param execute - The function to execute the tool. Optional.
|
|
164
|
-
*/
|
|
165
|
-
declare function textEditorTool_20241022<RESULT>(options?: {
|
|
166
|
-
execute?: ExecuteFunction<{
|
|
167
|
-
/**
|
|
168
|
-
* The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
|
|
169
|
-
*/
|
|
170
|
-
command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
|
|
171
|
-
/**
|
|
172
|
-
* Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
|
|
173
|
-
*/
|
|
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";
|
|
174
45
|
path: string;
|
|
175
|
-
/**
|
|
176
|
-
* Required parameter of `create` command, with the content of the file to be created.
|
|
177
|
-
*/
|
|
178
46
|
file_text?: string;
|
|
179
|
-
/**
|
|
180
|
-
* Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
|
|
181
|
-
*/
|
|
182
47
|
insert_line?: number;
|
|
183
|
-
/**
|
|
184
|
-
* 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.
|
|
185
|
-
*/
|
|
186
48
|
new_str?: string;
|
|
187
|
-
/**
|
|
188
|
-
* Required parameter of `str_replace` command containing the string in `path` to replace.
|
|
189
|
-
*/
|
|
190
49
|
old_str?: string;
|
|
191
|
-
/**
|
|
192
|
-
* 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.
|
|
193
|
-
*/
|
|
194
50
|
view_range?: number[];
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
parameters: typeof TextEditor20241022Parameters;
|
|
202
|
-
execute: ExecuteFunction<z.infer<typeof TextEditor20241022Parameters>, RESULT>;
|
|
203
|
-
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
204
|
-
};
|
|
205
|
-
declare const TextEditor20250124Parameters: z.ZodObject<{
|
|
206
|
-
command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
|
|
207
|
-
path: z.ZodString;
|
|
208
|
-
file_text: z.ZodOptional<z.ZodString>;
|
|
209
|
-
insert_line: z.ZodOptional<z.ZodNumber>;
|
|
210
|
-
new_str: z.ZodOptional<z.ZodString>;
|
|
211
|
-
old_str: z.ZodOptional<z.ZodString>;
|
|
212
|
-
view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
213
|
-
}, "strip", z.ZodTypeAny, {
|
|
214
|
-
path: string;
|
|
215
|
-
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
216
|
-
file_text?: string | undefined;
|
|
217
|
-
insert_line?: number | undefined;
|
|
218
|
-
new_str?: string | undefined;
|
|
219
|
-
old_str?: string | undefined;
|
|
220
|
-
view_range?: number[] | undefined;
|
|
221
|
-
}, {
|
|
222
|
-
path: string;
|
|
223
|
-
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
224
|
-
file_text?: string | undefined;
|
|
225
|
-
insert_line?: number | undefined;
|
|
226
|
-
new_str?: string | undefined;
|
|
227
|
-
old_str?: string | undefined;
|
|
228
|
-
view_range?: number[] | undefined;
|
|
229
|
-
}>;
|
|
230
|
-
/**
|
|
231
|
-
* Creates a tool for editing text. Must have name "str_replace_editor".
|
|
232
|
-
*
|
|
233
|
-
* Image results are supported.
|
|
234
|
-
*
|
|
235
|
-
* @param execute - The function to execute the tool. Optional.
|
|
236
|
-
*/
|
|
237
|
-
declare function textEditorTool_20250124<RESULT>(options?: {
|
|
238
|
-
execute?: ExecuteFunction<{
|
|
239
|
-
/**
|
|
240
|
-
* The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
|
|
241
|
-
*/
|
|
242
|
-
command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
|
|
243
|
-
/**
|
|
244
|
-
* Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
|
|
245
|
-
*/
|
|
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";
|
|
246
57
|
path: string;
|
|
247
|
-
/**
|
|
248
|
-
* Required parameter of `create` command, with the content of the file to be created.
|
|
249
|
-
*/
|
|
250
58
|
file_text?: string;
|
|
251
|
-
/**
|
|
252
|
-
* Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
|
|
253
|
-
*/
|
|
254
59
|
insert_line?: number;
|
|
255
|
-
/**
|
|
256
|
-
* 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.
|
|
257
|
-
*/
|
|
258
60
|
new_str?: string;
|
|
259
|
-
/**
|
|
260
|
-
* Required parameter of `str_replace` command containing the string in `path` to replace.
|
|
261
|
-
*/
|
|
262
61
|
old_str?: string;
|
|
263
|
-
/**
|
|
264
|
-
* 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.
|
|
265
|
-
*/
|
|
266
62
|
view_range?: number[];
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
*
|
|
293
|
-
* Image results are supported.
|
|
294
|
-
*
|
|
295
|
-
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
296
|
-
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
297
|
-
* @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.
|
|
298
|
-
* @param execute - The function to execute the tool. Optional.
|
|
299
|
-
*/
|
|
300
|
-
declare function computerTool_20241022<RESULT>(options: {
|
|
301
|
-
displayWidthPx: number;
|
|
302
|
-
displayHeightPx: number;
|
|
303
|
-
displayNumber?: number;
|
|
304
|
-
execute?: ExecuteFunction<{
|
|
305
|
-
/**
|
|
306
|
-
* The action to perform. The available actions are:
|
|
307
|
-
* - `key`: Press a key or key-combination on the keyboard.
|
|
308
|
-
* - This supports xdotool's `key` syntax.
|
|
309
|
-
* - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
|
|
310
|
-
* - `type`: Type a string of text on the keyboard.
|
|
311
|
-
* - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
|
|
312
|
-
* - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
|
|
313
|
-
* - `left_click`: Click the left mouse button.
|
|
314
|
-
* - `left_click_drag`: Click and drag the cursor to a specified (x, y) pixel coordinate on the screen.
|
|
315
|
-
* - `right_click`: Click the right mouse button.
|
|
316
|
-
* - `middle_click`: Click the middle mouse button.
|
|
317
|
-
* - `double_click`: Double-click the left mouse button.
|
|
318
|
-
* - `screenshot`: Take a screenshot of the screen.
|
|
319
|
-
*/
|
|
320
|
-
action: 'key' | 'type' | 'mouse_move' | 'left_click' | 'left_click_drag' | 'right_click' | 'middle_click' | 'double_click' | 'screenshot' | 'cursor_position';
|
|
321
|
-
/**
|
|
322
|
-
* (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`.
|
|
323
|
-
*/
|
|
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";
|
|
324
88
|
coordinate?: number[];
|
|
325
|
-
/**
|
|
326
|
-
* Required only by `action=type` and `action=key`.
|
|
327
|
-
*/
|
|
328
89
|
text?: string;
|
|
329
|
-
},
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
text: z.ZodOptional<z.ZodString>;
|
|
347
|
-
}, "strip", z.ZodTypeAny, {
|
|
348
|
-
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";
|
|
349
|
-
text?: string | undefined;
|
|
350
|
-
coordinate?: [number, number] | undefined;
|
|
351
|
-
duration?: number | undefined;
|
|
352
|
-
scroll_amount?: number | undefined;
|
|
353
|
-
scroll_direction?: "up" | "down" | "left" | "right" | undefined;
|
|
354
|
-
start_coordinate?: [number, number] | undefined;
|
|
355
|
-
}, {
|
|
356
|
-
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";
|
|
357
|
-
text?: string | undefined;
|
|
358
|
-
coordinate?: [number, number] | undefined;
|
|
359
|
-
duration?: number | undefined;
|
|
360
|
-
scroll_amount?: number | undefined;
|
|
361
|
-
scroll_direction?: "up" | "down" | "left" | "right" | undefined;
|
|
362
|
-
start_coordinate?: [number, number] | undefined;
|
|
363
|
-
}>;
|
|
364
|
-
/**
|
|
365
|
-
* Creates a tool for executing actions on a computer. Must have name "computer".
|
|
366
|
-
*
|
|
367
|
-
* Image results are supported.
|
|
368
|
-
*
|
|
369
|
-
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
370
|
-
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
371
|
-
* @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.
|
|
372
|
-
* @param execute - The function to execute the tool. Optional.
|
|
373
|
-
*/
|
|
374
|
-
declare function computerTool_20250124<RESULT>(options: {
|
|
375
|
-
displayWidthPx: number;
|
|
376
|
-
displayHeightPx: number;
|
|
377
|
-
displayNumber?: number;
|
|
378
|
-
execute?: ExecuteFunction<{
|
|
379
|
-
/**
|
|
380
|
-
* - `key`: Press a key or key-combination on the keyboard.
|
|
381
|
-
* - This supports xdotool's `key` syntax.
|
|
382
|
-
* - Examples: "a", "Return", "alt+Tab", "ctrl+s", "Up", "KP_0" (for the numpad 0 key).
|
|
383
|
-
* - `hold_key`: Hold down a key or multiple keys for a specified duration (in seconds). Supports the same syntax as `key`.
|
|
384
|
-
* - `type`: Type a string of text on the keyboard.
|
|
385
|
-
* - `cursor_position`: Get the current (x, y) pixel coordinate of the cursor on the screen.
|
|
386
|
-
* - `mouse_move`: Move the cursor to a specified (x, y) pixel coordinate on the screen.
|
|
387
|
-
* - `left_mouse_down`: Press the left mouse button.
|
|
388
|
-
* - `left_mouse_up`: Release the left mouse button.
|
|
389
|
-
* - `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.
|
|
390
|
-
* - `left_click_drag`: Click and drag the cursor from `start_coordinate` to a specified (x, y) pixel coordinate on the screen.
|
|
391
|
-
* - `right_click`: Click the right mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
392
|
-
* - `middle_click`: Click the middle mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
393
|
-
* - `double_click`: Double-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
394
|
-
* - `triple_click`: Triple-click the left mouse button at the specified (x, y) pixel coordinate on the screen.
|
|
395
|
-
* - `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.
|
|
396
|
-
* - `wait`: Wait for a specified duration (in seconds).
|
|
397
|
-
* - `screenshot`: Take a screenshot of the screen.
|
|
398
|
-
*/
|
|
399
|
-
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';
|
|
400
|
-
/**
|
|
401
|
-
* (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`.
|
|
402
|
-
*/
|
|
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";
|
|
403
107
|
coordinate?: [number, number];
|
|
404
|
-
/**
|
|
405
|
-
* The duration to hold the key down for. Required only by `action=hold_key` and `action=wait`.
|
|
406
|
-
*/
|
|
407
108
|
duration?: number;
|
|
408
|
-
/**
|
|
409
|
-
* The number of 'clicks' to scroll. Required only by `action=scroll`.
|
|
410
|
-
*/
|
|
411
109
|
scroll_amount?: number;
|
|
412
|
-
|
|
413
|
-
* The direction to scroll the screen. Required only by `action=scroll`.
|
|
414
|
-
*/
|
|
415
|
-
scroll_direction?: 'up' | 'down' | 'left' | 'right';
|
|
416
|
-
/**
|
|
417
|
-
* (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`.
|
|
418
|
-
*/
|
|
110
|
+
scroll_direction?: "up" | "down" | "left" | "right";
|
|
419
111
|
start_coordinate?: [number, number];
|
|
420
|
-
/**
|
|
421
|
-
* 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.
|
|
422
|
-
*/
|
|
423
112
|
text?: string;
|
|
424
|
-
},
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
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
|
+
}[]>;
|
|
441
155
|
};
|
|
442
156
|
|
|
443
157
|
interface AnthropicProvider extends ProviderV2 {
|
|
444
158
|
/**
|
|
445
159
|
Creates a model for text generation.
|
|
446
160
|
*/
|
|
447
|
-
(modelId: AnthropicMessagesModelId
|
|
161
|
+
(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
448
162
|
/**
|
|
449
163
|
Creates a model for text generation.
|
|
450
164
|
*/
|
|
451
|
-
languageModel(modelId: AnthropicMessagesModelId
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
*/
|
|
455
|
-
chat(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV2;
|
|
456
|
-
/**
|
|
457
|
-
@deprecated Use `.languageModel()` instead.
|
|
458
|
-
*/
|
|
459
|
-
messages(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): LanguageModelV2;
|
|
165
|
+
languageModel(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
166
|
+
chat(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
167
|
+
messages(modelId: AnthropicMessagesModelId): LanguageModelV2;
|
|
460
168
|
/**
|
|
461
169
|
Anthropic-specific computer use tool.
|
|
462
170
|
*/
|