@ai-sdk/anthropic 1.1.11 → 1.1.13
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 +12 -0
- package/dist/index.d.mts +118 -0
- package/dist/index.d.ts +118 -0
- package/dist/index.js +72 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -12
- package/dist/index.mjs.map +1 -1
- package/internal/dist/index.d.mts +118 -0
- package/internal/dist/index.d.ts +118 -0
- package/internal/dist/index.js +72 -12
- package/internal/dist/index.js.map +1 -1
- package/internal/dist/index.mjs +72 -12
- package/internal/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 1.1.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3004b14: feat(provider/anthropic): add bash_20250124 and text_editor_20250124 tools
|
|
8
|
+
|
|
9
|
+
## 1.1.12
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- b3e5a15: fix (provider/anthropic): add model setting to allow omitting reasoning content from model requests
|
|
14
|
+
|
|
3
15
|
## 1.1.11
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -12,6 +12,13 @@ interface AnthropicMessagesSettings {
|
|
|
12
12
|
optionally mark content for caching) and this setting is no longer needed.
|
|
13
13
|
*/
|
|
14
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;
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
type ExecuteFunction<PARAMETERS, RESULT> = undefined | ((args: PARAMETERS, options: {
|
|
@@ -62,6 +69,43 @@ declare function bashTool_20241022<RESULT>(options?: {
|
|
|
62
69
|
execute: ExecuteFunction<z.infer<typeof Bash20241022Parameters>, RESULT>;
|
|
63
70
|
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
64
71
|
};
|
|
72
|
+
declare const Bash20250124Parameters: z.ZodObject<{
|
|
73
|
+
command: z.ZodString;
|
|
74
|
+
restart: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
command: string;
|
|
77
|
+
restart?: boolean | undefined;
|
|
78
|
+
}, {
|
|
79
|
+
command: string;
|
|
80
|
+
restart?: boolean | undefined;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a tool for running a bash command. Must have name "bash".
|
|
84
|
+
*
|
|
85
|
+
* Image results are supported.
|
|
86
|
+
*
|
|
87
|
+
* @param execute - The function to execute the tool. Optional.
|
|
88
|
+
*/
|
|
89
|
+
declare function bashTool_20250124<RESULT>(options?: {
|
|
90
|
+
execute?: ExecuteFunction<{
|
|
91
|
+
/**
|
|
92
|
+
* The bash command to run. Required unless the tool is being restarted.
|
|
93
|
+
*/
|
|
94
|
+
command: string;
|
|
95
|
+
/**
|
|
96
|
+
* Specifying true will restart this tool. Otherwise, leave this unspecified.
|
|
97
|
+
*/
|
|
98
|
+
restart?: boolean;
|
|
99
|
+
}, RESULT>;
|
|
100
|
+
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
101
|
+
}): {
|
|
102
|
+
type: 'provider-defined';
|
|
103
|
+
id: 'anthropic.bash_20250124';
|
|
104
|
+
args: {};
|
|
105
|
+
parameters: typeof Bash20250124Parameters;
|
|
106
|
+
execute: ExecuteFunction<z.infer<typeof Bash20250124Parameters>, RESULT>;
|
|
107
|
+
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
108
|
+
};
|
|
65
109
|
declare const TextEditor20241022Parameters: z.ZodObject<{
|
|
66
110
|
command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
|
|
67
111
|
path: z.ZodString;
|
|
@@ -134,6 +178,78 @@ declare function textEditorTool_20241022<RESULT>(options?: {
|
|
|
134
178
|
execute: ExecuteFunction<z.infer<typeof TextEditor20241022Parameters>, RESULT>;
|
|
135
179
|
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
136
180
|
};
|
|
181
|
+
declare const TextEditor20250124Parameters: z.ZodObject<{
|
|
182
|
+
command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
|
|
183
|
+
path: z.ZodString;
|
|
184
|
+
file_text: z.ZodOptional<z.ZodString>;
|
|
185
|
+
insert_line: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
new_str: z.ZodOptional<z.ZodString>;
|
|
187
|
+
old_str: z.ZodOptional<z.ZodString>;
|
|
188
|
+
view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
189
|
+
}, "strip", z.ZodTypeAny, {
|
|
190
|
+
path: string;
|
|
191
|
+
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
192
|
+
file_text?: string | undefined;
|
|
193
|
+
insert_line?: number | undefined;
|
|
194
|
+
new_str?: string | undefined;
|
|
195
|
+
old_str?: string | undefined;
|
|
196
|
+
view_range?: number[] | undefined;
|
|
197
|
+
}, {
|
|
198
|
+
path: string;
|
|
199
|
+
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
200
|
+
file_text?: string | undefined;
|
|
201
|
+
insert_line?: number | undefined;
|
|
202
|
+
new_str?: string | undefined;
|
|
203
|
+
old_str?: string | undefined;
|
|
204
|
+
view_range?: number[] | undefined;
|
|
205
|
+
}>;
|
|
206
|
+
/**
|
|
207
|
+
* Creates a tool for editing text. Must have name "str_replace_editor".
|
|
208
|
+
*
|
|
209
|
+
* Image results are supported.
|
|
210
|
+
*
|
|
211
|
+
* @param execute - The function to execute the tool. Optional.
|
|
212
|
+
*/
|
|
213
|
+
declare function textEditorTool_20250124<RESULT>(options?: {
|
|
214
|
+
execute?: ExecuteFunction<{
|
|
215
|
+
/**
|
|
216
|
+
* The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
|
|
217
|
+
*/
|
|
218
|
+
command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
|
|
219
|
+
/**
|
|
220
|
+
* Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
|
|
221
|
+
*/
|
|
222
|
+
path: string;
|
|
223
|
+
/**
|
|
224
|
+
* Required parameter of `create` command, with the content of the file to be created.
|
|
225
|
+
*/
|
|
226
|
+
file_text?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
|
|
229
|
+
*/
|
|
230
|
+
insert_line?: number;
|
|
231
|
+
/**
|
|
232
|
+
* 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.
|
|
233
|
+
*/
|
|
234
|
+
new_str?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Required parameter of `str_replace` command containing the string in `path` to replace.
|
|
237
|
+
*/
|
|
238
|
+
old_str?: string;
|
|
239
|
+
/**
|
|
240
|
+
* 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.
|
|
241
|
+
*/
|
|
242
|
+
view_range?: number[];
|
|
243
|
+
}, RESULT>;
|
|
244
|
+
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
245
|
+
}): {
|
|
246
|
+
type: 'provider-defined';
|
|
247
|
+
id: 'anthropic.text_editor_20250124';
|
|
248
|
+
args: {};
|
|
249
|
+
parameters: typeof TextEditor20250124Parameters;
|
|
250
|
+
execute: ExecuteFunction<z.infer<typeof TextEditor20250124Parameters>, RESULT>;
|
|
251
|
+
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
252
|
+
};
|
|
137
253
|
declare const Computer20241022Parameters: z.ZodObject<{
|
|
138
254
|
action: z.ZodEnum<["key", "type", "mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "screenshot", "cursor_position"]>;
|
|
139
255
|
coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
@@ -293,7 +409,9 @@ declare function computerTool_20250124<RESULT>(options: {
|
|
|
293
409
|
};
|
|
294
410
|
declare const anthropicTools: {
|
|
295
411
|
bash_20241022: typeof bashTool_20241022;
|
|
412
|
+
bash_20250124: typeof bashTool_20250124;
|
|
296
413
|
textEditor_20241022: typeof textEditorTool_20241022;
|
|
414
|
+
textEditor_20250124: typeof textEditorTool_20250124;
|
|
297
415
|
computer_20241022: typeof computerTool_20241022;
|
|
298
416
|
computer_20250124: typeof computerTool_20250124;
|
|
299
417
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,13 @@ interface AnthropicMessagesSettings {
|
|
|
12
12
|
optionally mark content for caching) and this setting is no longer needed.
|
|
13
13
|
*/
|
|
14
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;
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
type ExecuteFunction<PARAMETERS, RESULT> = undefined | ((args: PARAMETERS, options: {
|
|
@@ -62,6 +69,43 @@ declare function bashTool_20241022<RESULT>(options?: {
|
|
|
62
69
|
execute: ExecuteFunction<z.infer<typeof Bash20241022Parameters>, RESULT>;
|
|
63
70
|
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
64
71
|
};
|
|
72
|
+
declare const Bash20250124Parameters: z.ZodObject<{
|
|
73
|
+
command: z.ZodString;
|
|
74
|
+
restart: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
command: string;
|
|
77
|
+
restart?: boolean | undefined;
|
|
78
|
+
}, {
|
|
79
|
+
command: string;
|
|
80
|
+
restart?: boolean | undefined;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a tool for running a bash command. Must have name "bash".
|
|
84
|
+
*
|
|
85
|
+
* Image results are supported.
|
|
86
|
+
*
|
|
87
|
+
* @param execute - The function to execute the tool. Optional.
|
|
88
|
+
*/
|
|
89
|
+
declare function bashTool_20250124<RESULT>(options?: {
|
|
90
|
+
execute?: ExecuteFunction<{
|
|
91
|
+
/**
|
|
92
|
+
* The bash command to run. Required unless the tool is being restarted.
|
|
93
|
+
*/
|
|
94
|
+
command: string;
|
|
95
|
+
/**
|
|
96
|
+
* Specifying true will restart this tool. Otherwise, leave this unspecified.
|
|
97
|
+
*/
|
|
98
|
+
restart?: boolean;
|
|
99
|
+
}, RESULT>;
|
|
100
|
+
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
101
|
+
}): {
|
|
102
|
+
type: 'provider-defined';
|
|
103
|
+
id: 'anthropic.bash_20250124';
|
|
104
|
+
args: {};
|
|
105
|
+
parameters: typeof Bash20250124Parameters;
|
|
106
|
+
execute: ExecuteFunction<z.infer<typeof Bash20250124Parameters>, RESULT>;
|
|
107
|
+
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
108
|
+
};
|
|
65
109
|
declare const TextEditor20241022Parameters: z.ZodObject<{
|
|
66
110
|
command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
|
|
67
111
|
path: z.ZodString;
|
|
@@ -134,6 +178,78 @@ declare function textEditorTool_20241022<RESULT>(options?: {
|
|
|
134
178
|
execute: ExecuteFunction<z.infer<typeof TextEditor20241022Parameters>, RESULT>;
|
|
135
179
|
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
136
180
|
};
|
|
181
|
+
declare const TextEditor20250124Parameters: z.ZodObject<{
|
|
182
|
+
command: z.ZodEnum<["view", "create", "str_replace", "insert", "undo_edit"]>;
|
|
183
|
+
path: z.ZodString;
|
|
184
|
+
file_text: z.ZodOptional<z.ZodString>;
|
|
185
|
+
insert_line: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
new_str: z.ZodOptional<z.ZodString>;
|
|
187
|
+
old_str: z.ZodOptional<z.ZodString>;
|
|
188
|
+
view_range: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
189
|
+
}, "strip", z.ZodTypeAny, {
|
|
190
|
+
path: string;
|
|
191
|
+
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
192
|
+
file_text?: string | undefined;
|
|
193
|
+
insert_line?: number | undefined;
|
|
194
|
+
new_str?: string | undefined;
|
|
195
|
+
old_str?: string | undefined;
|
|
196
|
+
view_range?: number[] | undefined;
|
|
197
|
+
}, {
|
|
198
|
+
path: string;
|
|
199
|
+
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
200
|
+
file_text?: string | undefined;
|
|
201
|
+
insert_line?: number | undefined;
|
|
202
|
+
new_str?: string | undefined;
|
|
203
|
+
old_str?: string | undefined;
|
|
204
|
+
view_range?: number[] | undefined;
|
|
205
|
+
}>;
|
|
206
|
+
/**
|
|
207
|
+
* Creates a tool for editing text. Must have name "str_replace_editor".
|
|
208
|
+
*
|
|
209
|
+
* Image results are supported.
|
|
210
|
+
*
|
|
211
|
+
* @param execute - The function to execute the tool. Optional.
|
|
212
|
+
*/
|
|
213
|
+
declare function textEditorTool_20250124<RESULT>(options?: {
|
|
214
|
+
execute?: ExecuteFunction<{
|
|
215
|
+
/**
|
|
216
|
+
* The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`.
|
|
217
|
+
*/
|
|
218
|
+
command: 'view' | 'create' | 'str_replace' | 'insert' | 'undo_edit';
|
|
219
|
+
/**
|
|
220
|
+
* Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.
|
|
221
|
+
*/
|
|
222
|
+
path: string;
|
|
223
|
+
/**
|
|
224
|
+
* Required parameter of `create` command, with the content of the file to be created.
|
|
225
|
+
*/
|
|
226
|
+
file_text?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.
|
|
229
|
+
*/
|
|
230
|
+
insert_line?: number;
|
|
231
|
+
/**
|
|
232
|
+
* 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.
|
|
233
|
+
*/
|
|
234
|
+
new_str?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Required parameter of `str_replace` command containing the string in `path` to replace.
|
|
237
|
+
*/
|
|
238
|
+
old_str?: string;
|
|
239
|
+
/**
|
|
240
|
+
* 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.
|
|
241
|
+
*/
|
|
242
|
+
view_range?: number[];
|
|
243
|
+
}, RESULT>;
|
|
244
|
+
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
245
|
+
}): {
|
|
246
|
+
type: 'provider-defined';
|
|
247
|
+
id: 'anthropic.text_editor_20250124';
|
|
248
|
+
args: {};
|
|
249
|
+
parameters: typeof TextEditor20250124Parameters;
|
|
250
|
+
execute: ExecuteFunction<z.infer<typeof TextEditor20250124Parameters>, RESULT>;
|
|
251
|
+
experimental_toToolResultContent?: (result: RESULT) => ToolResultContent;
|
|
252
|
+
};
|
|
137
253
|
declare const Computer20241022Parameters: z.ZodObject<{
|
|
138
254
|
action: z.ZodEnum<["key", "type", "mouse_move", "left_click", "left_click_drag", "right_click", "middle_click", "double_click", "screenshot", "cursor_position"]>;
|
|
139
255
|
coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
@@ -293,7 +409,9 @@ declare function computerTool_20250124<RESULT>(options: {
|
|
|
293
409
|
};
|
|
294
410
|
declare const anthropicTools: {
|
|
295
411
|
bash_20241022: typeof bashTool_20241022;
|
|
412
|
+
bash_20250124: typeof bashTool_20250124;
|
|
296
413
|
textEditor_20241022: typeof textEditorTool_20241022;
|
|
414
|
+
textEditor_20250124: typeof textEditorTool_20250124;
|
|
297
415
|
computer_20241022: typeof computerTool_20241022;
|
|
298
416
|
computer_20250124: typeof computerTool_20250124;
|
|
299
417
|
};
|
package/dist/index.js
CHANGED
|
@@ -91,6 +91,13 @@ function prepareTools(mode) {
|
|
|
91
91
|
display_number: tool.args.displayNumber
|
|
92
92
|
});
|
|
93
93
|
break;
|
|
94
|
+
case "anthropic.text_editor_20250124":
|
|
95
|
+
betas.add("computer-use-2025-01-24");
|
|
96
|
+
anthropicTools2.push({
|
|
97
|
+
name: tool.name,
|
|
98
|
+
type: "text_editor_20250124"
|
|
99
|
+
});
|
|
100
|
+
break;
|
|
94
101
|
case "anthropic.text_editor_20241022":
|
|
95
102
|
betas.add("computer-use-2024-10-22");
|
|
96
103
|
anthropicTools2.push({
|
|
@@ -98,6 +105,13 @@ function prepareTools(mode) {
|
|
|
98
105
|
type: "text_editor_20241022"
|
|
99
106
|
});
|
|
100
107
|
break;
|
|
108
|
+
case "anthropic.bash_20250124":
|
|
109
|
+
betas.add("computer-use-2025-01-24");
|
|
110
|
+
anthropicTools2.push({
|
|
111
|
+
name: tool.name,
|
|
112
|
+
type: "bash_20250124"
|
|
113
|
+
});
|
|
114
|
+
break;
|
|
101
115
|
case "anthropic.bash_20241022":
|
|
102
116
|
betas.add("computer-use-2024-10-22");
|
|
103
117
|
anthropicTools2.push({
|
|
@@ -162,7 +176,9 @@ function prepareTools(mode) {
|
|
|
162
176
|
var import_provider2 = require("@ai-sdk/provider");
|
|
163
177
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
164
178
|
function convertToAnthropicMessagesPrompt({
|
|
165
|
-
prompt
|
|
179
|
+
prompt,
|
|
180
|
+
sendReasoning,
|
|
181
|
+
warnings
|
|
166
182
|
}) {
|
|
167
183
|
var _a, _b, _c, _d;
|
|
168
184
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -326,12 +342,19 @@ function convertToAnthropicMessagesPrompt({
|
|
|
326
342
|
break;
|
|
327
343
|
}
|
|
328
344
|
case "reasoning": {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
345
|
+
if (sendReasoning) {
|
|
346
|
+
anthropicContent.push({
|
|
347
|
+
type: "thinking",
|
|
348
|
+
thinking: part.text,
|
|
349
|
+
signature: part.signature,
|
|
350
|
+
cache_control: cacheControl
|
|
351
|
+
});
|
|
352
|
+
} else {
|
|
353
|
+
warnings.push({
|
|
354
|
+
type: "other",
|
|
355
|
+
message: "sending reasoning content is disabled for this model"
|
|
356
|
+
});
|
|
357
|
+
}
|
|
335
358
|
break;
|
|
336
359
|
}
|
|
337
360
|
case "redacted-reasoning": {
|
|
@@ -463,7 +486,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
463
486
|
seed,
|
|
464
487
|
providerMetadata: providerOptions
|
|
465
488
|
}) {
|
|
466
|
-
var _a, _b, _c;
|
|
489
|
+
var _a, _b, _c, _d;
|
|
467
490
|
const type = mode.type;
|
|
468
491
|
const warnings = [];
|
|
469
492
|
if (frequencyPenalty != null) {
|
|
@@ -492,10 +515,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
492
515
|
});
|
|
493
516
|
}
|
|
494
517
|
const { prompt: messagesPrompt, betas: messagesBetas } = convertToAnthropicMessagesPrompt({
|
|
495
|
-
prompt
|
|
518
|
+
prompt,
|
|
519
|
+
sendReasoning: (_a = this.settings.sendReasoning) != null ? _a : true,
|
|
520
|
+
warnings
|
|
496
521
|
});
|
|
497
522
|
const thinkingOptions = thinkingOptionsSchema.safeParse(
|
|
498
|
-
(
|
|
523
|
+
(_b = providerOptions == null ? void 0 : providerOptions.anthropic) == null ? void 0 : _b.thinking
|
|
499
524
|
);
|
|
500
525
|
if (!thinkingOptions.success) {
|
|
501
526
|
throw new import_provider3.InvalidArgumentError({
|
|
@@ -504,8 +529,8 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
504
529
|
cause: thinkingOptions.error
|
|
505
530
|
});
|
|
506
531
|
}
|
|
507
|
-
const isThinking = ((
|
|
508
|
-
const thinkingBudget = (
|
|
532
|
+
const isThinking = ((_c = thinkingOptions.data) == null ? void 0 : _c.type) === "enabled";
|
|
533
|
+
const thinkingBudget = (_d = thinkingOptions.data) == null ? void 0 : _d.budgetTokens;
|
|
509
534
|
const baseArgs = {
|
|
510
535
|
// model id:
|
|
511
536
|
model: this.modelId,
|
|
@@ -998,6 +1023,20 @@ function bashTool_20241022(options = {}) {
|
|
|
998
1023
|
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
999
1024
|
};
|
|
1000
1025
|
}
|
|
1026
|
+
var Bash20250124Parameters = import_zod3.z.object({
|
|
1027
|
+
command: import_zod3.z.string(),
|
|
1028
|
+
restart: import_zod3.z.boolean().optional()
|
|
1029
|
+
});
|
|
1030
|
+
function bashTool_20250124(options = {}) {
|
|
1031
|
+
return {
|
|
1032
|
+
type: "provider-defined",
|
|
1033
|
+
id: "anthropic.bash_20250124",
|
|
1034
|
+
args: {},
|
|
1035
|
+
parameters: Bash20250124Parameters,
|
|
1036
|
+
execute: options.execute,
|
|
1037
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1001
1040
|
var TextEditor20241022Parameters = import_zod3.z.object({
|
|
1002
1041
|
command: import_zod3.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
1003
1042
|
path: import_zod3.z.string(),
|
|
@@ -1017,6 +1056,25 @@ function textEditorTool_20241022(options = {}) {
|
|
|
1017
1056
|
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
1018
1057
|
};
|
|
1019
1058
|
}
|
|
1059
|
+
var TextEditor20250124Parameters = import_zod3.z.object({
|
|
1060
|
+
command: import_zod3.z.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
1061
|
+
path: import_zod3.z.string(),
|
|
1062
|
+
file_text: import_zod3.z.string().optional(),
|
|
1063
|
+
insert_line: import_zod3.z.number().int().optional(),
|
|
1064
|
+
new_str: import_zod3.z.string().optional(),
|
|
1065
|
+
old_str: import_zod3.z.string().optional(),
|
|
1066
|
+
view_range: import_zod3.z.array(import_zod3.z.number().int()).optional()
|
|
1067
|
+
});
|
|
1068
|
+
function textEditorTool_20250124(options = {}) {
|
|
1069
|
+
return {
|
|
1070
|
+
type: "provider-defined",
|
|
1071
|
+
id: "anthropic.text_editor_20250124",
|
|
1072
|
+
args: {},
|
|
1073
|
+
parameters: TextEditor20250124Parameters,
|
|
1074
|
+
execute: options.execute,
|
|
1075
|
+
experimental_toToolResultContent: options.experimental_toToolResultContent
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1020
1078
|
var Computer20241022Parameters = import_zod3.z.object({
|
|
1021
1079
|
action: import_zod3.z.enum([
|
|
1022
1080
|
"key",
|
|
@@ -1089,7 +1147,9 @@ function computerTool_20250124(options) {
|
|
|
1089
1147
|
}
|
|
1090
1148
|
var anthropicTools = {
|
|
1091
1149
|
bash_20241022: bashTool_20241022,
|
|
1150
|
+
bash_20250124: bashTool_20250124,
|
|
1092
1151
|
textEditor_20241022: textEditorTool_20241022,
|
|
1152
|
+
textEditor_20250124: textEditorTool_20250124,
|
|
1093
1153
|
computer_20241022: computerTool_20241022,
|
|
1094
1154
|
computer_20250124: computerTool_20250124
|
|
1095
1155
|
};
|