@ai-sdk/anthropic 2.1.0-beta.1 → 2.1.0-beta.11
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 +88 -0
- package/dist/index.d.mts +114 -10
- package/dist/index.d.ts +114 -10
- package/dist/index.js +682 -389
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +665 -372
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +131 -15
- package/dist/internal/index.d.ts +131 -15
- package/dist/internal/index.js +662 -377
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +647 -362
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LanguageModelV3, JSONSchema7, LanguageModelV3CallOptions, LanguageModelV3CallWarning } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
type AnthropicMessagesModelId = 'claude-
|
|
5
|
+
type AnthropicMessagesModelId = 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
|
|
6
6
|
|
|
7
7
|
type AnthropicMessagesConfig = {
|
|
8
8
|
provider: string;
|
|
@@ -11,11 +11,11 @@ type AnthropicMessagesConfig = {
|
|
|
11
11
|
fetch?: FetchFunction;
|
|
12
12
|
buildRequestUrl?: (baseURL: string, isStreaming: boolean) => string;
|
|
13
13
|
transformRequestBody?: (args: Record<string, any>) => Record<string, any>;
|
|
14
|
-
supportedUrls?: () =>
|
|
14
|
+
supportedUrls?: () => LanguageModelV3['supportedUrls'];
|
|
15
15
|
generateId?: () => string;
|
|
16
16
|
};
|
|
17
|
-
declare class AnthropicMessagesLanguageModel implements
|
|
18
|
-
readonly specificationVersion = "
|
|
17
|
+
declare class AnthropicMessagesLanguageModel implements LanguageModelV3 {
|
|
18
|
+
readonly specificationVersion = "v3";
|
|
19
19
|
readonly modelId: AnthropicMessagesModelId;
|
|
20
20
|
private readonly config;
|
|
21
21
|
private readonly generateId;
|
|
@@ -28,8 +28,8 @@ declare class AnthropicMessagesLanguageModel implements LanguageModelV2 {
|
|
|
28
28
|
private buildRequestUrl;
|
|
29
29
|
private transformRequestBody;
|
|
30
30
|
private extractCitationDocuments;
|
|
31
|
-
doGenerate(options: Parameters<
|
|
32
|
-
doStream(options: Parameters<
|
|
31
|
+
doGenerate(options: Parameters<LanguageModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV3['doGenerate']>>>;
|
|
32
|
+
doStream(options: Parameters<LanguageModelV3['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV3['doStream']>>>;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
declare const anthropicTools: {
|
|
@@ -133,6 +133,8 @@ declare const anthropicTools: {
|
|
|
133
133
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
134
134
|
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
135
135
|
*
|
|
136
|
+
* Supported models: Claude Sonnet 3.5
|
|
137
|
+
*
|
|
136
138
|
* Tool name must be `str_replace_editor`.
|
|
137
139
|
*/
|
|
138
140
|
textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
@@ -149,6 +151,8 @@ declare const anthropicTools: {
|
|
|
149
151
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
150
152
|
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
151
153
|
*
|
|
154
|
+
* Supported models: Claude Sonnet 3.7
|
|
155
|
+
*
|
|
152
156
|
* Tool name must be `str_replace_editor`.
|
|
153
157
|
*/
|
|
154
158
|
textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
@@ -168,6 +172,8 @@ declare const anthropicTools: {
|
|
|
168
172
|
* Note: This version does not support the "undo_edit" command.
|
|
169
173
|
*
|
|
170
174
|
* Tool name must be `str_replace_based_edit_tool`.
|
|
175
|
+
*
|
|
176
|
+
* @deprecated Use textEditor_20250728 instead
|
|
171
177
|
*/
|
|
172
178
|
textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
173
179
|
command: "view" | "create" | "str_replace" | "insert";
|
|
@@ -178,6 +184,102 @@ declare const anthropicTools: {
|
|
|
178
184
|
old_str?: string;
|
|
179
185
|
view_range?: number[];
|
|
180
186
|
}, {}>;
|
|
187
|
+
/**
|
|
188
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
189
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
190
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
191
|
+
*
|
|
192
|
+
* Note: This version does not support the "undo_edit" command and adds optional max_characters parameter.
|
|
193
|
+
*
|
|
194
|
+
* Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
|
|
195
|
+
*
|
|
196
|
+
* Tool name must be `str_replace_based_edit_tool`.
|
|
197
|
+
*
|
|
198
|
+
* @param maxCharacters - Optional maximum number of characters to view in the file
|
|
199
|
+
*/
|
|
200
|
+
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
201
|
+
command: "view" | "create" | "str_replace" | "insert";
|
|
202
|
+
path: string;
|
|
203
|
+
file_text?: string;
|
|
204
|
+
insert_line?: number;
|
|
205
|
+
new_str?: string;
|
|
206
|
+
old_str?: string;
|
|
207
|
+
view_range?: number[];
|
|
208
|
+
}, {
|
|
209
|
+
maxCharacters?: number;
|
|
210
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
211
|
+
command: "view" | "create" | "str_replace" | "insert";
|
|
212
|
+
path: string;
|
|
213
|
+
file_text?: string;
|
|
214
|
+
insert_line?: number;
|
|
215
|
+
new_str?: string;
|
|
216
|
+
old_str?: string;
|
|
217
|
+
view_range?: number[];
|
|
218
|
+
}, unknown>;
|
|
219
|
+
/**
|
|
220
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
221
|
+
*
|
|
222
|
+
* Tool name must be `web_fetch`.
|
|
223
|
+
*
|
|
224
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
225
|
+
* @param allowedDomains - Only fetch from these domains
|
|
226
|
+
* @param blockedDomains - Never fetch from these domains
|
|
227
|
+
* @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
|
|
228
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
229
|
+
*/
|
|
230
|
+
webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
|
|
231
|
+
url: string;
|
|
232
|
+
}, {
|
|
233
|
+
type: "web_fetch_result";
|
|
234
|
+
url: string;
|
|
235
|
+
content: {
|
|
236
|
+
type: "document";
|
|
237
|
+
title: string;
|
|
238
|
+
citations?: {
|
|
239
|
+
enabled: boolean;
|
|
240
|
+
};
|
|
241
|
+
source: {
|
|
242
|
+
type: "base64";
|
|
243
|
+
mediaType: "application/pdf";
|
|
244
|
+
data: string;
|
|
245
|
+
} | {
|
|
246
|
+
type: "text";
|
|
247
|
+
mediaType: "text/plain";
|
|
248
|
+
data: string;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
retrievedAt: string | null;
|
|
252
|
+
}, {
|
|
253
|
+
maxUses?: number;
|
|
254
|
+
allowedDomains?: string[];
|
|
255
|
+
blockedDomains?: string[];
|
|
256
|
+
citations?: {
|
|
257
|
+
enabled: boolean;
|
|
258
|
+
};
|
|
259
|
+
maxContentTokens?: number;
|
|
260
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
261
|
+
url: string;
|
|
262
|
+
}, {
|
|
263
|
+
type: "web_fetch_result";
|
|
264
|
+
url: string;
|
|
265
|
+
content: {
|
|
266
|
+
type: "document";
|
|
267
|
+
title: string;
|
|
268
|
+
citations?: {
|
|
269
|
+
enabled: boolean;
|
|
270
|
+
};
|
|
271
|
+
source: {
|
|
272
|
+
type: "base64";
|
|
273
|
+
mediaType: "application/pdf";
|
|
274
|
+
data: string;
|
|
275
|
+
} | {
|
|
276
|
+
type: "text";
|
|
277
|
+
mediaType: "text/plain";
|
|
278
|
+
data: string;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
retrievedAt: string | null;
|
|
282
|
+
}>;
|
|
181
283
|
/**
|
|
182
284
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
183
285
|
*
|
|
@@ -191,11 +293,11 @@ declare const anthropicTools: {
|
|
|
191
293
|
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
|
|
192
294
|
query: string;
|
|
193
295
|
}, {
|
|
296
|
+
type: "web_search_result";
|
|
194
297
|
url: string;
|
|
195
298
|
title: string;
|
|
196
299
|
pageAge: string | null;
|
|
197
300
|
encryptedContent: string;
|
|
198
|
-
type: string;
|
|
199
301
|
}[], {
|
|
200
302
|
maxUses?: number;
|
|
201
303
|
allowedDomains?: string[];
|
|
@@ -210,11 +312,11 @@ declare const anthropicTools: {
|
|
|
210
312
|
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
211
313
|
query: string;
|
|
212
314
|
}, {
|
|
315
|
+
type: "web_search_result";
|
|
213
316
|
url: string;
|
|
214
317
|
title: string;
|
|
215
318
|
pageAge: string | null;
|
|
216
319
|
encryptedContent: string;
|
|
217
|
-
type: string;
|
|
218
320
|
}[]>;
|
|
219
321
|
};
|
|
220
322
|
|
|
@@ -226,6 +328,9 @@ type AnthropicTool = {
|
|
|
226
328
|
description: string | undefined;
|
|
227
329
|
input_schema: JSONSchema7;
|
|
228
330
|
cache_control: AnthropicCacheControl | undefined;
|
|
331
|
+
} | {
|
|
332
|
+
type: 'code_execution_20250522';
|
|
333
|
+
name: string;
|
|
229
334
|
} | {
|
|
230
335
|
name: string;
|
|
231
336
|
type: 'computer_20250124' | 'computer_20241022';
|
|
@@ -235,9 +340,23 @@ type AnthropicTool = {
|
|
|
235
340
|
} | {
|
|
236
341
|
name: string;
|
|
237
342
|
type: 'text_editor_20250124' | 'text_editor_20241022' | 'text_editor_20250429';
|
|
343
|
+
} | {
|
|
344
|
+
name: string;
|
|
345
|
+
type: 'text_editor_20250728';
|
|
346
|
+
max_characters?: number;
|
|
238
347
|
} | {
|
|
239
348
|
name: string;
|
|
240
349
|
type: 'bash_20250124' | 'bash_20241022';
|
|
350
|
+
} | {
|
|
351
|
+
type: 'web_fetch_20250910';
|
|
352
|
+
name: string;
|
|
353
|
+
max_uses?: number;
|
|
354
|
+
allowed_domains?: string[];
|
|
355
|
+
blocked_domains?: string[];
|
|
356
|
+
citations?: {
|
|
357
|
+
enabled: boolean;
|
|
358
|
+
};
|
|
359
|
+
max_content_tokens?: number;
|
|
241
360
|
} | {
|
|
242
361
|
type: 'web_search_20250305';
|
|
243
362
|
name: string;
|
|
@@ -251,9 +370,6 @@ type AnthropicTool = {
|
|
|
251
370
|
country?: string;
|
|
252
371
|
timezone?: string;
|
|
253
372
|
};
|
|
254
|
-
} | {
|
|
255
|
-
type: 'code_execution_20250522';
|
|
256
|
-
name: string;
|
|
257
373
|
};
|
|
258
374
|
type AnthropicToolChoice = {
|
|
259
375
|
type: 'auto' | 'any';
|
|
@@ -265,13 +381,13 @@ type AnthropicToolChoice = {
|
|
|
265
381
|
};
|
|
266
382
|
|
|
267
383
|
declare function prepareTools({ tools, toolChoice, disableParallelToolUse, }: {
|
|
268
|
-
tools:
|
|
269
|
-
toolChoice?:
|
|
384
|
+
tools: LanguageModelV3CallOptions['tools'];
|
|
385
|
+
toolChoice?: LanguageModelV3CallOptions['toolChoice'];
|
|
270
386
|
disableParallelToolUse?: boolean;
|
|
271
387
|
}): {
|
|
272
388
|
tools: Array<AnthropicTool> | undefined;
|
|
273
389
|
toolChoice: AnthropicToolChoice | undefined;
|
|
274
|
-
toolWarnings:
|
|
390
|
+
toolWarnings: LanguageModelV3CallWarning[];
|
|
275
391
|
betas: Set<string>;
|
|
276
392
|
};
|
|
277
393
|
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LanguageModelV3, JSONSchema7, LanguageModelV3CallOptions, LanguageModelV3CallWarning } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
|
|
5
|
-
type AnthropicMessagesModelId = 'claude-
|
|
5
|
+
type AnthropicMessagesModelId = 'claude-sonnet-4-5' | 'claude-sonnet-4-5-20250929' | 'claude-opus-4-1' | 'claude-opus-4-0' | 'claude-sonnet-4-0' | 'claude-opus-4-1-20250805' | 'claude-opus-4-20250514' | 'claude-sonnet-4-20250514' | 'claude-3-7-sonnet-latest' | 'claude-3-7-sonnet-20250219' | 'claude-3-5-haiku-latest' | 'claude-3-5-haiku-20241022' | 'claude-3-haiku-20240307' | (string & {});
|
|
6
6
|
|
|
7
7
|
type AnthropicMessagesConfig = {
|
|
8
8
|
provider: string;
|
|
@@ -11,11 +11,11 @@ type AnthropicMessagesConfig = {
|
|
|
11
11
|
fetch?: FetchFunction;
|
|
12
12
|
buildRequestUrl?: (baseURL: string, isStreaming: boolean) => string;
|
|
13
13
|
transformRequestBody?: (args: Record<string, any>) => Record<string, any>;
|
|
14
|
-
supportedUrls?: () =>
|
|
14
|
+
supportedUrls?: () => LanguageModelV3['supportedUrls'];
|
|
15
15
|
generateId?: () => string;
|
|
16
16
|
};
|
|
17
|
-
declare class AnthropicMessagesLanguageModel implements
|
|
18
|
-
readonly specificationVersion = "
|
|
17
|
+
declare class AnthropicMessagesLanguageModel implements LanguageModelV3 {
|
|
18
|
+
readonly specificationVersion = "v3";
|
|
19
19
|
readonly modelId: AnthropicMessagesModelId;
|
|
20
20
|
private readonly config;
|
|
21
21
|
private readonly generateId;
|
|
@@ -28,8 +28,8 @@ declare class AnthropicMessagesLanguageModel implements LanguageModelV2 {
|
|
|
28
28
|
private buildRequestUrl;
|
|
29
29
|
private transformRequestBody;
|
|
30
30
|
private extractCitationDocuments;
|
|
31
|
-
doGenerate(options: Parameters<
|
|
32
|
-
doStream(options: Parameters<
|
|
31
|
+
doGenerate(options: Parameters<LanguageModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV3['doGenerate']>>>;
|
|
32
|
+
doStream(options: Parameters<LanguageModelV3['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV3['doStream']>>>;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
declare const anthropicTools: {
|
|
@@ -133,6 +133,8 @@ declare const anthropicTools: {
|
|
|
133
133
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
134
134
|
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
135
135
|
*
|
|
136
|
+
* Supported models: Claude Sonnet 3.5
|
|
137
|
+
*
|
|
136
138
|
* Tool name must be `str_replace_editor`.
|
|
137
139
|
*/
|
|
138
140
|
textEditor_20241022: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
@@ -149,6 +151,8 @@ declare const anthropicTools: {
|
|
|
149
151
|
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
150
152
|
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
151
153
|
*
|
|
154
|
+
* Supported models: Claude Sonnet 3.7
|
|
155
|
+
*
|
|
152
156
|
* Tool name must be `str_replace_editor`.
|
|
153
157
|
*/
|
|
154
158
|
textEditor_20250124: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
@@ -168,6 +172,8 @@ declare const anthropicTools: {
|
|
|
168
172
|
* Note: This version does not support the "undo_edit" command.
|
|
169
173
|
*
|
|
170
174
|
* Tool name must be `str_replace_based_edit_tool`.
|
|
175
|
+
*
|
|
176
|
+
* @deprecated Use textEditor_20250728 instead
|
|
171
177
|
*/
|
|
172
178
|
textEditor_20250429: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
173
179
|
command: "view" | "create" | "str_replace" | "insert";
|
|
@@ -178,6 +184,102 @@ declare const anthropicTools: {
|
|
|
178
184
|
old_str?: string;
|
|
179
185
|
view_range?: number[];
|
|
180
186
|
}, {}>;
|
|
187
|
+
/**
|
|
188
|
+
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
189
|
+
* helping you debug, fix, and improve your code or other text documents. This allows Claude
|
|
190
|
+
* to directly interact with your files, providing hands-on assistance rather than just suggesting changes.
|
|
191
|
+
*
|
|
192
|
+
* Note: This version does not support the "undo_edit" command and adds optional max_characters parameter.
|
|
193
|
+
*
|
|
194
|
+
* Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
|
|
195
|
+
*
|
|
196
|
+
* Tool name must be `str_replace_based_edit_tool`.
|
|
197
|
+
*
|
|
198
|
+
* @param maxCharacters - Optional maximum number of characters to view in the file
|
|
199
|
+
*/
|
|
200
|
+
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactory<{
|
|
201
|
+
command: "view" | "create" | "str_replace" | "insert";
|
|
202
|
+
path: string;
|
|
203
|
+
file_text?: string;
|
|
204
|
+
insert_line?: number;
|
|
205
|
+
new_str?: string;
|
|
206
|
+
old_str?: string;
|
|
207
|
+
view_range?: number[];
|
|
208
|
+
}, {
|
|
209
|
+
maxCharacters?: number;
|
|
210
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
211
|
+
command: "view" | "create" | "str_replace" | "insert";
|
|
212
|
+
path: string;
|
|
213
|
+
file_text?: string;
|
|
214
|
+
insert_line?: number;
|
|
215
|
+
new_str?: string;
|
|
216
|
+
old_str?: string;
|
|
217
|
+
view_range?: number[];
|
|
218
|
+
}, unknown>;
|
|
219
|
+
/**
|
|
220
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
221
|
+
*
|
|
222
|
+
* Tool name must be `web_fetch`.
|
|
223
|
+
*
|
|
224
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
225
|
+
* @param allowedDomains - Only fetch from these domains
|
|
226
|
+
* @param blockedDomains - Never fetch from these domains
|
|
227
|
+
* @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
|
|
228
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
229
|
+
*/
|
|
230
|
+
webFetch_20250910: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
|
|
231
|
+
url: string;
|
|
232
|
+
}, {
|
|
233
|
+
type: "web_fetch_result";
|
|
234
|
+
url: string;
|
|
235
|
+
content: {
|
|
236
|
+
type: "document";
|
|
237
|
+
title: string;
|
|
238
|
+
citations?: {
|
|
239
|
+
enabled: boolean;
|
|
240
|
+
};
|
|
241
|
+
source: {
|
|
242
|
+
type: "base64";
|
|
243
|
+
mediaType: "application/pdf";
|
|
244
|
+
data: string;
|
|
245
|
+
} | {
|
|
246
|
+
type: "text";
|
|
247
|
+
mediaType: "text/plain";
|
|
248
|
+
data: string;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
retrievedAt: string | null;
|
|
252
|
+
}, {
|
|
253
|
+
maxUses?: number;
|
|
254
|
+
allowedDomains?: string[];
|
|
255
|
+
blockedDomains?: string[];
|
|
256
|
+
citations?: {
|
|
257
|
+
enabled: boolean;
|
|
258
|
+
};
|
|
259
|
+
maxContentTokens?: number;
|
|
260
|
+
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
261
|
+
url: string;
|
|
262
|
+
}, {
|
|
263
|
+
type: "web_fetch_result";
|
|
264
|
+
url: string;
|
|
265
|
+
content: {
|
|
266
|
+
type: "document";
|
|
267
|
+
title: string;
|
|
268
|
+
citations?: {
|
|
269
|
+
enabled: boolean;
|
|
270
|
+
};
|
|
271
|
+
source: {
|
|
272
|
+
type: "base64";
|
|
273
|
+
mediaType: "application/pdf";
|
|
274
|
+
data: string;
|
|
275
|
+
} | {
|
|
276
|
+
type: "text";
|
|
277
|
+
mediaType: "text/plain";
|
|
278
|
+
data: string;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
retrievedAt: string | null;
|
|
282
|
+
}>;
|
|
181
283
|
/**
|
|
182
284
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
183
285
|
*
|
|
@@ -191,11 +293,11 @@ declare const anthropicTools: {
|
|
|
191
293
|
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
|
|
192
294
|
query: string;
|
|
193
295
|
}, {
|
|
296
|
+
type: "web_search_result";
|
|
194
297
|
url: string;
|
|
195
298
|
title: string;
|
|
196
299
|
pageAge: string | null;
|
|
197
300
|
encryptedContent: string;
|
|
198
|
-
type: string;
|
|
199
301
|
}[], {
|
|
200
302
|
maxUses?: number;
|
|
201
303
|
allowedDomains?: string[];
|
|
@@ -210,11 +312,11 @@ declare const anthropicTools: {
|
|
|
210
312
|
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
211
313
|
query: string;
|
|
212
314
|
}, {
|
|
315
|
+
type: "web_search_result";
|
|
213
316
|
url: string;
|
|
214
317
|
title: string;
|
|
215
318
|
pageAge: string | null;
|
|
216
319
|
encryptedContent: string;
|
|
217
|
-
type: string;
|
|
218
320
|
}[]>;
|
|
219
321
|
};
|
|
220
322
|
|
|
@@ -226,6 +328,9 @@ type AnthropicTool = {
|
|
|
226
328
|
description: string | undefined;
|
|
227
329
|
input_schema: JSONSchema7;
|
|
228
330
|
cache_control: AnthropicCacheControl | undefined;
|
|
331
|
+
} | {
|
|
332
|
+
type: 'code_execution_20250522';
|
|
333
|
+
name: string;
|
|
229
334
|
} | {
|
|
230
335
|
name: string;
|
|
231
336
|
type: 'computer_20250124' | 'computer_20241022';
|
|
@@ -235,9 +340,23 @@ type AnthropicTool = {
|
|
|
235
340
|
} | {
|
|
236
341
|
name: string;
|
|
237
342
|
type: 'text_editor_20250124' | 'text_editor_20241022' | 'text_editor_20250429';
|
|
343
|
+
} | {
|
|
344
|
+
name: string;
|
|
345
|
+
type: 'text_editor_20250728';
|
|
346
|
+
max_characters?: number;
|
|
238
347
|
} | {
|
|
239
348
|
name: string;
|
|
240
349
|
type: 'bash_20250124' | 'bash_20241022';
|
|
350
|
+
} | {
|
|
351
|
+
type: 'web_fetch_20250910';
|
|
352
|
+
name: string;
|
|
353
|
+
max_uses?: number;
|
|
354
|
+
allowed_domains?: string[];
|
|
355
|
+
blocked_domains?: string[];
|
|
356
|
+
citations?: {
|
|
357
|
+
enabled: boolean;
|
|
358
|
+
};
|
|
359
|
+
max_content_tokens?: number;
|
|
241
360
|
} | {
|
|
242
361
|
type: 'web_search_20250305';
|
|
243
362
|
name: string;
|
|
@@ -251,9 +370,6 @@ type AnthropicTool = {
|
|
|
251
370
|
country?: string;
|
|
252
371
|
timezone?: string;
|
|
253
372
|
};
|
|
254
|
-
} | {
|
|
255
|
-
type: 'code_execution_20250522';
|
|
256
|
-
name: string;
|
|
257
373
|
};
|
|
258
374
|
type AnthropicToolChoice = {
|
|
259
375
|
type: 'auto' | 'any';
|
|
@@ -265,13 +381,13 @@ type AnthropicToolChoice = {
|
|
|
265
381
|
};
|
|
266
382
|
|
|
267
383
|
declare function prepareTools({ tools, toolChoice, disableParallelToolUse, }: {
|
|
268
|
-
tools:
|
|
269
|
-
toolChoice?:
|
|
384
|
+
tools: LanguageModelV3CallOptions['tools'];
|
|
385
|
+
toolChoice?: LanguageModelV3CallOptions['toolChoice'];
|
|
270
386
|
disableParallelToolUse?: boolean;
|
|
271
387
|
}): {
|
|
272
388
|
tools: Array<AnthropicTool> | undefined;
|
|
273
389
|
toolChoice: AnthropicToolChoice | undefined;
|
|
274
|
-
toolWarnings:
|
|
390
|
+
toolWarnings: LanguageModelV3CallWarning[];
|
|
275
391
|
betas: Set<string>;
|
|
276
392
|
};
|
|
277
393
|
|