@ai-sdk/anthropic 2.0.13 → 2.0.15
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 +89 -61
- package/dist/index.d.ts +89 -61
- package/dist/index.js +53 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -32
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +89 -61
- package/dist/internal/index.d.ts +89 -61
- package/dist/internal/index.js +53 -32
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +53 -32
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 2.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c8aab0a: fix (provider/anthropic): revert cd458a8c1667df86e6987a1f2e06159823453864
|
|
8
|
+
|
|
9
|
+
## 2.0.14
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 2338c79: feat (provider/anthropic): update jsdoc of anthropic tools
|
|
14
|
+
|
|
3
15
|
## 2.0.13
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -16,69 +16,62 @@ type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
|
16
16
|
|
|
17
17
|
declare const anthropicTools: {
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
20
|
+
* allowing system operations, script execution, and command-line automation.
|
|
20
21
|
*
|
|
21
22
|
* Image results are supported.
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
+
* Tool name must be `bash`.
|
|
24
25
|
*/
|
|
25
26
|
bash_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
26
27
|
command: string;
|
|
27
28
|
restart?: boolean;
|
|
28
29
|
}, {}>;
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
+
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
32
|
+
* allowing system operations, script execution, and command-line automation.
|
|
31
33
|
*
|
|
32
34
|
* Image results are supported.
|
|
33
35
|
*
|
|
34
|
-
*
|
|
36
|
+
* Tool name must be `bash`.
|
|
35
37
|
*/
|
|
36
38
|
bash_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
37
39
|
command: string;
|
|
38
40
|
restart?: boolean;
|
|
39
41
|
}, {}>;
|
|
40
42
|
/**
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
old_str?: string;
|
|
50
|
-
view_range?: number[];
|
|
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";
|
|
57
|
-
path: string;
|
|
58
|
-
file_text?: string;
|
|
59
|
-
insert_line?: number;
|
|
60
|
-
new_str?: string;
|
|
61
|
-
old_str?: string;
|
|
62
|
-
view_range?: number[];
|
|
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.
|
|
43
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
44
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
45
|
+
* the API conversation.
|
|
46
|
+
*
|
|
47
|
+
* The code execution tool allows Claude to run Bash commands and manipulate files,
|
|
48
|
+
* including writing code, in a secure, sandboxed environment.
|
|
49
|
+
*
|
|
50
|
+
* Tool name must be `code_execution`.
|
|
67
51
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
52
|
+
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
|
|
53
|
+
code: string;
|
|
54
|
+
}, {
|
|
55
|
+
type: "code_execution_result";
|
|
56
|
+
stdout: string;
|
|
57
|
+
stderr: string;
|
|
58
|
+
return_code: number;
|
|
59
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
60
|
+
code: string;
|
|
61
|
+
}, {
|
|
62
|
+
type: "code_execution_result";
|
|
63
|
+
stdout: string;
|
|
64
|
+
stderr: string;
|
|
65
|
+
return_code: number;
|
|
66
|
+
}>;
|
|
77
67
|
/**
|
|
78
|
-
*
|
|
68
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
69
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
79
70
|
*
|
|
80
71
|
* Image results are supported.
|
|
81
72
|
*
|
|
73
|
+
* Tool name must be `computer`.
|
|
74
|
+
*
|
|
82
75
|
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
83
76
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
84
77
|
* @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.
|
|
@@ -93,14 +86,16 @@ declare const anthropicTools: {
|
|
|
93
86
|
displayNumber?: number;
|
|
94
87
|
}>;
|
|
95
88
|
/**
|
|
96
|
-
*
|
|
89
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
90
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
97
91
|
*
|
|
98
92
|
* Image results are supported.
|
|
99
93
|
*
|
|
94
|
+
* Tool name must be `computer`.
|
|
95
|
+
*
|
|
100
96
|
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
101
97
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
102
98
|
* @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
99
|
*/
|
|
105
100
|
computer_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
106
101
|
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";
|
|
@@ -115,9 +110,60 @@ declare const anthropicTools: {
|
|
|
115
110
|
displayHeightPx: number;
|
|
116
111
|
displayNumber?: number;
|
|
117
112
|
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
115
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
116
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
117
|
+
*
|
|
118
|
+
* Tool name must be `str_replace_editor`.
|
|
119
|
+
*/
|
|
120
|
+
textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
121
|
+
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
122
|
+
path: string;
|
|
123
|
+
file_text?: string;
|
|
124
|
+
insert_line?: number;
|
|
125
|
+
new_str?: string;
|
|
126
|
+
old_str?: string;
|
|
127
|
+
view_range?: number[];
|
|
128
|
+
}, {}>;
|
|
129
|
+
/**
|
|
130
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
131
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
132
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
133
|
+
*
|
|
134
|
+
* Tool name must be `str_replace_editor`.
|
|
135
|
+
*/
|
|
136
|
+
textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
137
|
+
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
138
|
+
path: string;
|
|
139
|
+
file_text?: string;
|
|
140
|
+
insert_line?: number;
|
|
141
|
+
new_str?: string;
|
|
142
|
+
old_str?: string;
|
|
143
|
+
view_range?: number[];
|
|
144
|
+
}, {}>;
|
|
145
|
+
/**
|
|
146
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
147
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
148
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
149
|
+
*
|
|
150
|
+
* Note: This version does not support the "undo_edit" command.
|
|
151
|
+
*
|
|
152
|
+
* Tool name must be `str_replace_based_edit_tool`.
|
|
153
|
+
*/
|
|
154
|
+
textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
155
|
+
command: "view" | "create" | "str_replace" | "insert";
|
|
156
|
+
path: string;
|
|
157
|
+
file_text?: string;
|
|
158
|
+
insert_line?: number;
|
|
159
|
+
new_str?: string;
|
|
160
|
+
old_str?: string;
|
|
161
|
+
view_range?: number[];
|
|
162
|
+
}, {}>;
|
|
118
163
|
/**
|
|
119
164
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
120
|
-
*
|
|
165
|
+
*
|
|
166
|
+
* Tool name must be `web_search`.
|
|
121
167
|
*
|
|
122
168
|
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
123
169
|
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
@@ -152,24 +198,6 @@ declare const anthropicTools: {
|
|
|
152
198
|
encryptedContent: string;
|
|
153
199
|
type: string;
|
|
154
200
|
}[]>;
|
|
155
|
-
/**
|
|
156
|
-
* Creates a tool for executing Python code. Must have name "code_execution".
|
|
157
|
-
*/
|
|
158
|
-
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
|
|
159
|
-
code: string;
|
|
160
|
-
}, {
|
|
161
|
-
type: "code_execution_result";
|
|
162
|
-
stdout: string;
|
|
163
|
-
stderr: string;
|
|
164
|
-
return_code: number;
|
|
165
|
-
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
166
|
-
code: string;
|
|
167
|
-
}, {
|
|
168
|
-
type: "code_execution_result";
|
|
169
|
-
stdout: string;
|
|
170
|
-
stderr: string;
|
|
171
|
-
return_code: number;
|
|
172
|
-
}>;
|
|
173
201
|
};
|
|
174
202
|
|
|
175
203
|
interface AnthropicProvider extends ProviderV2 {
|
package/dist/index.d.ts
CHANGED
|
@@ -16,69 +16,62 @@ type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
|
16
16
|
|
|
17
17
|
declare const anthropicTools: {
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
20
|
+
* allowing system operations, script execution, and command-line automation.
|
|
20
21
|
*
|
|
21
22
|
* Image results are supported.
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
+
* Tool name must be `bash`.
|
|
24
25
|
*/
|
|
25
26
|
bash_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
26
27
|
command: string;
|
|
27
28
|
restart?: boolean;
|
|
28
29
|
}, {}>;
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
+
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
32
|
+
* allowing system operations, script execution, and command-line automation.
|
|
31
33
|
*
|
|
32
34
|
* Image results are supported.
|
|
33
35
|
*
|
|
34
|
-
*
|
|
36
|
+
* Tool name must be `bash`.
|
|
35
37
|
*/
|
|
36
38
|
bash_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
37
39
|
command: string;
|
|
38
40
|
restart?: boolean;
|
|
39
41
|
}, {}>;
|
|
40
42
|
/**
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
old_str?: string;
|
|
50
|
-
view_range?: number[];
|
|
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";
|
|
57
|
-
path: string;
|
|
58
|
-
file_text?: string;
|
|
59
|
-
insert_line?: number;
|
|
60
|
-
new_str?: string;
|
|
61
|
-
old_str?: string;
|
|
62
|
-
view_range?: number[];
|
|
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.
|
|
43
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
44
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
45
|
+
* the API conversation.
|
|
46
|
+
*
|
|
47
|
+
* The code execution tool allows Claude to run Bash commands and manipulate files,
|
|
48
|
+
* including writing code, in a secure, sandboxed environment.
|
|
49
|
+
*
|
|
50
|
+
* Tool name must be `code_execution`.
|
|
67
51
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
52
|
+
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
|
|
53
|
+
code: string;
|
|
54
|
+
}, {
|
|
55
|
+
type: "code_execution_result";
|
|
56
|
+
stdout: string;
|
|
57
|
+
stderr: string;
|
|
58
|
+
return_code: number;
|
|
59
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
60
|
+
code: string;
|
|
61
|
+
}, {
|
|
62
|
+
type: "code_execution_result";
|
|
63
|
+
stdout: string;
|
|
64
|
+
stderr: string;
|
|
65
|
+
return_code: number;
|
|
66
|
+
}>;
|
|
77
67
|
/**
|
|
78
|
-
*
|
|
68
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
69
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
79
70
|
*
|
|
80
71
|
* Image results are supported.
|
|
81
72
|
*
|
|
73
|
+
* Tool name must be `computer`.
|
|
74
|
+
*
|
|
82
75
|
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
83
76
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
84
77
|
* @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.
|
|
@@ -93,14 +86,16 @@ declare const anthropicTools: {
|
|
|
93
86
|
displayNumber?: number;
|
|
94
87
|
}>;
|
|
95
88
|
/**
|
|
96
|
-
*
|
|
89
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
90
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
97
91
|
*
|
|
98
92
|
* Image results are supported.
|
|
99
93
|
*
|
|
94
|
+
* Tool name must be `computer`.
|
|
95
|
+
*
|
|
100
96
|
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
101
97
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
102
98
|
* @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
99
|
*/
|
|
105
100
|
computer_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
106
101
|
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";
|
|
@@ -115,9 +110,60 @@ declare const anthropicTools: {
|
|
|
115
110
|
displayHeightPx: number;
|
|
116
111
|
displayNumber?: number;
|
|
117
112
|
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
115
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
116
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
117
|
+
*
|
|
118
|
+
* Tool name must be `str_replace_editor`.
|
|
119
|
+
*/
|
|
120
|
+
textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
121
|
+
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
122
|
+
path: string;
|
|
123
|
+
file_text?: string;
|
|
124
|
+
insert_line?: number;
|
|
125
|
+
new_str?: string;
|
|
126
|
+
old_str?: string;
|
|
127
|
+
view_range?: number[];
|
|
128
|
+
}, {}>;
|
|
129
|
+
/**
|
|
130
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
131
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
132
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
133
|
+
*
|
|
134
|
+
* Tool name must be `str_replace_editor`.
|
|
135
|
+
*/
|
|
136
|
+
textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
137
|
+
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
138
|
+
path: string;
|
|
139
|
+
file_text?: string;
|
|
140
|
+
insert_line?: number;
|
|
141
|
+
new_str?: string;
|
|
142
|
+
old_str?: string;
|
|
143
|
+
view_range?: number[];
|
|
144
|
+
}, {}>;
|
|
145
|
+
/**
|
|
146
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
147
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
148
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
149
|
+
*
|
|
150
|
+
* Note: This version does not support the "undo_edit" command.
|
|
151
|
+
*
|
|
152
|
+
* Tool name must be `str_replace_based_edit_tool`.
|
|
153
|
+
*/
|
|
154
|
+
textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
155
|
+
command: "view" | "create" | "str_replace" | "insert";
|
|
156
|
+
path: string;
|
|
157
|
+
file_text?: string;
|
|
158
|
+
insert_line?: number;
|
|
159
|
+
new_str?: string;
|
|
160
|
+
old_str?: string;
|
|
161
|
+
view_range?: number[];
|
|
162
|
+
}, {}>;
|
|
118
163
|
/**
|
|
119
164
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
120
|
-
*
|
|
165
|
+
*
|
|
166
|
+
* Tool name must be `web_search`.
|
|
121
167
|
*
|
|
122
168
|
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
123
169
|
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
@@ -152,24 +198,6 @@ declare const anthropicTools: {
|
|
|
152
198
|
encryptedContent: string;
|
|
153
199
|
type: string;
|
|
154
200
|
}[]>;
|
|
155
|
-
/**
|
|
156
|
-
* Creates a tool for executing Python code. Must have name "code_execution".
|
|
157
|
-
*/
|
|
158
|
-
codeExecution_20250522: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
|
|
159
|
-
code: string;
|
|
160
|
-
}, {
|
|
161
|
-
type: "code_execution_result";
|
|
162
|
-
stdout: string;
|
|
163
|
-
stderr: string;
|
|
164
|
-
return_code: number;
|
|
165
|
-
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
166
|
-
code: string;
|
|
167
|
-
}, {
|
|
168
|
-
type: "code_execution_result";
|
|
169
|
-
stdout: string;
|
|
170
|
-
stderr: string;
|
|
171
|
-
return_code: number;
|
|
172
|
-
}>;
|
|
173
201
|
};
|
|
174
202
|
|
|
175
203
|
interface AnthropicProvider extends ProviderV2 {
|
package/dist/index.js
CHANGED
|
@@ -571,14 +571,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
|
|
575
|
-
(part) => part.type === "tool_result"
|
|
576
|
-
);
|
|
577
|
-
const otherParts = anthropicContent.filter(
|
|
578
|
-
(part) => part.type !== "tool_result"
|
|
579
|
-
);
|
|
580
|
-
const reorderedContent = toolResultParts.length > 0 ? [...toolResultParts, ...otherParts] : anthropicContent;
|
|
581
|
-
messages.push({ role: "user", content: reorderedContent });
|
|
574
|
+
messages.push({ role: "user", content: anthropicContent });
|
|
582
575
|
break;
|
|
583
576
|
}
|
|
584
577
|
case "assistant": {
|
|
@@ -2004,69 +1997,97 @@ var textEditor_20250429 = (0, import_provider_utils12.createProviderDefinedToolF
|
|
|
2004
1997
|
// src/anthropic-tools.ts
|
|
2005
1998
|
var anthropicTools = {
|
|
2006
1999
|
/**
|
|
2007
|
-
*
|
|
2000
|
+
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
2001
|
+
* allowing system operations, script execution, and command-line automation.
|
|
2008
2002
|
*
|
|
2009
2003
|
* Image results are supported.
|
|
2010
2004
|
*
|
|
2011
|
-
*
|
|
2005
|
+
* Tool name must be `bash`.
|
|
2012
2006
|
*/
|
|
2013
2007
|
bash_20241022,
|
|
2014
2008
|
/**
|
|
2015
|
-
*
|
|
2009
|
+
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
2010
|
+
* allowing system operations, script execution, and command-line automation.
|
|
2016
2011
|
*
|
|
2017
2012
|
* Image results are supported.
|
|
2018
2013
|
*
|
|
2019
|
-
*
|
|
2014
|
+
* Tool name must be `bash`.
|
|
2020
2015
|
*/
|
|
2021
2016
|
bash_20250124,
|
|
2022
2017
|
/**
|
|
2023
|
-
*
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
*
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
* Creates a tool for editing text. Must have name "str_replace_based_edit_tool".
|
|
2032
|
-
* Note: This version does not support the "undo_edit" command.
|
|
2018
|
+
* Claude can analyze data, create visualizations, perform complex calculations,
|
|
2019
|
+
* run system commands, create and edit files, and process uploaded files directly within
|
|
2020
|
+
* the API conversation.
|
|
2021
|
+
*
|
|
2022
|
+
* The code execution tool allows Claude to run Bash commands and manipulate files,
|
|
2023
|
+
* including writing code, in a secure, sandboxed environment.
|
|
2024
|
+
*
|
|
2025
|
+
* Tool name must be `code_execution`.
|
|
2033
2026
|
*/
|
|
2034
|
-
|
|
2027
|
+
codeExecution_20250522,
|
|
2035
2028
|
/**
|
|
2036
|
-
*
|
|
2029
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
2030
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
2037
2031
|
*
|
|
2038
2032
|
* Image results are supported.
|
|
2039
2033
|
*
|
|
2034
|
+
* Tool name must be `computer`.
|
|
2035
|
+
*
|
|
2040
2036
|
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
2041
2037
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
2042
2038
|
* @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.
|
|
2043
2039
|
*/
|
|
2044
2040
|
computer_20241022,
|
|
2045
2041
|
/**
|
|
2046
|
-
*
|
|
2042
|
+
* Claude can interact with computer environments through the computer use tool, which
|
|
2043
|
+
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
2047
2044
|
*
|
|
2048
2045
|
* Image results are supported.
|
|
2049
2046
|
*
|
|
2047
|
+
* Tool name must be `computer`.
|
|
2048
|
+
*
|
|
2050
2049
|
* @param displayWidthPx - The width of the display being controlled by the model in pixels.
|
|
2051
2050
|
* @param displayHeightPx - The height of the display being controlled by the model in pixels.
|
|
2052
2051
|
* @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.
|
|
2053
|
-
* @param execute - The function to execute the tool. Optional.
|
|
2054
2052
|
*/
|
|
2055
2053
|
computer_20250124,
|
|
2054
|
+
/**
|
|
2055
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
2056
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
2057
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
2058
|
+
*
|
|
2059
|
+
* Tool name must be `str_replace_editor`.
|
|
2060
|
+
*/
|
|
2061
|
+
textEditor_20241022,
|
|
2062
|
+
/**
|
|
2063
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
2064
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
2065
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
2066
|
+
*
|
|
2067
|
+
* Tool name must be `str_replace_editor`.
|
|
2068
|
+
*/
|
|
2069
|
+
textEditor_20250124,
|
|
2070
|
+
/**
|
|
2071
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
2072
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
2073
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
2074
|
+
*
|
|
2075
|
+
* Note: This version does not support the "undo_edit" command.
|
|
2076
|
+
*
|
|
2077
|
+
* Tool name must be `str_replace_based_edit_tool`.
|
|
2078
|
+
*/
|
|
2079
|
+
textEditor_20250429,
|
|
2056
2080
|
/**
|
|
2057
2081
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
2058
|
-
*
|
|
2082
|
+
*
|
|
2083
|
+
* Tool name must be `web_search`.
|
|
2059
2084
|
*
|
|
2060
2085
|
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
2061
2086
|
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
2062
2087
|
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
2063
2088
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
2064
2089
|
*/
|
|
2065
|
-
webSearch_20250305
|
|
2066
|
-
/**
|
|
2067
|
-
* Creates a tool for executing Python code. Must have name "code_execution".
|
|
2068
|
-
*/
|
|
2069
|
-
codeExecution_20250522
|
|
2090
|
+
webSearch_20250305
|
|
2070
2091
|
};
|
|
2071
2092
|
|
|
2072
2093
|
// src/anthropic-provider.ts
|