@ai-sdk/anthropic 4.0.54 → 4.0.56
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 +26 -0
- package/dist/index.d.ts +107 -1
- package/dist/index.js +662 -484
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +109 -2
- package/dist/internal/index.js +608 -435
- package/dist/internal/index.js.map +1 -1
- package/docs/05-anthropic.mdx +91 -7
- package/package.json +3 -3
- package/src/anthropic-api.ts +8 -2
- package/src/anthropic-language-model.ts +14 -12
- package/src/anthropic-prepare-tools.ts +38 -0
- package/src/anthropic-provider.ts +10 -0
- package/src/anthropic-tools.ts +26 -0
- package/src/convert-to-anthropic-prompt.ts +8 -7
- package/src/tool/web-fetch-20260318.ts +159 -0
- package/src/tool/web-search_20260318.ts +143 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 4.0.56
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d4d96bf: Add `anthropic.evaluationModel()` for experimental Choice, Score, and Boolean evaluations through Messages structured output, with exact labels, validated score bounds, and prompted Boolean P(true) estimates validated to be in [0, 1]. Boolean estimates are not guaranteed to be calibrated; application code chooses thresholds.
|
|
8
|
+
- Updated dependencies [215b25e]
|
|
9
|
+
- Updated dependencies [d4d96bf]
|
|
10
|
+
- Updated dependencies [a7dd893]
|
|
11
|
+
- Updated dependencies [3456e2c]
|
|
12
|
+
- Updated dependencies [c4e76de]
|
|
13
|
+
- @ai-sdk/provider-utils@5.0.43
|
|
14
|
+
- @ai-sdk/provider@4.0.17
|
|
15
|
+
|
|
16
|
+
## 4.0.55
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 132bdae: feat(anthropic): add 20260318 web search and web fetch tools with response inclusion controls
|
|
21
|
+
- Updated dependencies [91c2128]
|
|
22
|
+
- Updated dependencies [2cd80b3]
|
|
23
|
+
- Updated dependencies [d06bb2a]
|
|
24
|
+
- Updated dependencies [123d71f]
|
|
25
|
+
- Updated dependencies [2fa5e0e]
|
|
26
|
+
- @ai-sdk/provider-utils@5.0.42
|
|
27
|
+
- @ai-sdk/provider@4.0.16
|
|
28
|
+
|
|
3
29
|
## 4.0.54
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSONObject, ProviderV4, LanguageModelV4, Experimental_BatchV4, FilesV4, SkillsV4 } from '@ai-sdk/provider';
|
|
1
|
+
import { JSONObject, ProviderV4, LanguageModelV4, Experimental_EvaluationModelV4, Experimental_BatchV4, FilesV4, SkillsV4 } from '@ai-sdk/provider';
|
|
2
2
|
import { z } from 'zod/v4';
|
|
3
3
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
4
4
|
import { ToolExecuteFunction, Tool, Experimental_SandboxSession, ProviderDefinedTool, FetchFunction } from '@ai-sdk/provider-utils';
|
|
@@ -1131,6 +1131,72 @@ declare const anthropicTools: {
|
|
|
1131
1131
|
};
|
|
1132
1132
|
retrievedAt: string | null;
|
|
1133
1133
|
}, {}>;
|
|
1134
|
+
/**
|
|
1135
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
1136
|
+
*
|
|
1137
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
1138
|
+
* @param allowedDomains - Only fetch from these domains
|
|
1139
|
+
* @param blockedDomains - Never fetch from these domains
|
|
1140
|
+
* @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.
|
|
1141
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
1142
|
+
* @param useCache - Whether cached content may be returned. Set to false to fetch fresh content.
|
|
1143
|
+
* @param responseInclusion - Whether result blocks consumed by completed code execution calls are returned. Defaults to "full".
|
|
1144
|
+
*/
|
|
1145
|
+
webFetch_20260318: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
1146
|
+
url: string;
|
|
1147
|
+
}, {
|
|
1148
|
+
type: "web_fetch_result";
|
|
1149
|
+
url: string;
|
|
1150
|
+
content: {
|
|
1151
|
+
type: "document";
|
|
1152
|
+
title: string | null;
|
|
1153
|
+
citations?: {
|
|
1154
|
+
enabled: boolean;
|
|
1155
|
+
};
|
|
1156
|
+
source: {
|
|
1157
|
+
type: "base64";
|
|
1158
|
+
mediaType: "application/pdf";
|
|
1159
|
+
data: string;
|
|
1160
|
+
} | {
|
|
1161
|
+
type: "text";
|
|
1162
|
+
mediaType: "text/plain";
|
|
1163
|
+
data: string;
|
|
1164
|
+
};
|
|
1165
|
+
};
|
|
1166
|
+
retrievedAt: string | null;
|
|
1167
|
+
}, {
|
|
1168
|
+
maxUses?: number;
|
|
1169
|
+
allowedDomains?: string[];
|
|
1170
|
+
blockedDomains?: string[];
|
|
1171
|
+
citations?: {
|
|
1172
|
+
enabled: boolean;
|
|
1173
|
+
};
|
|
1174
|
+
maxContentTokens?: number;
|
|
1175
|
+
useCache?: boolean;
|
|
1176
|
+
responseInclusion?: "full" | "excluded";
|
|
1177
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
1178
|
+
url: string;
|
|
1179
|
+
}, {
|
|
1180
|
+
type: "web_fetch_result";
|
|
1181
|
+
url: string;
|
|
1182
|
+
content: {
|
|
1183
|
+
type: "document";
|
|
1184
|
+
title: string | null;
|
|
1185
|
+
citations?: {
|
|
1186
|
+
enabled: boolean;
|
|
1187
|
+
};
|
|
1188
|
+
source: {
|
|
1189
|
+
type: "base64";
|
|
1190
|
+
mediaType: "application/pdf";
|
|
1191
|
+
data: string;
|
|
1192
|
+
} | {
|
|
1193
|
+
type: "text";
|
|
1194
|
+
mediaType: "text/plain";
|
|
1195
|
+
data: string;
|
|
1196
|
+
};
|
|
1197
|
+
};
|
|
1198
|
+
retrievedAt: string | null;
|
|
1199
|
+
}, {}>;
|
|
1134
1200
|
/**
|
|
1135
1201
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
1136
1202
|
*
|
|
@@ -1203,6 +1269,44 @@ declare const anthropicTools: {
|
|
|
1203
1269
|
pageAge: string | null;
|
|
1204
1270
|
encryptedContent: string;
|
|
1205
1271
|
}[], {}>;
|
|
1272
|
+
/**
|
|
1273
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
1274
|
+
*
|
|
1275
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
1276
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
1277
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
1278
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
1279
|
+
* @param responseInclusion - Whether result blocks consumed by completed code execution calls are returned. Defaults to "full".
|
|
1280
|
+
*/
|
|
1281
|
+
webSearch_20260318: (args?: Parameters<_ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
1282
|
+
query: string;
|
|
1283
|
+
}, {
|
|
1284
|
+
type: "web_search_result";
|
|
1285
|
+
url: string;
|
|
1286
|
+
title: string | null;
|
|
1287
|
+
pageAge: string | null;
|
|
1288
|
+
encryptedContent: string;
|
|
1289
|
+
}[], {
|
|
1290
|
+
maxUses?: number;
|
|
1291
|
+
allowedDomains?: string[];
|
|
1292
|
+
blockedDomains?: string[];
|
|
1293
|
+
userLocation?: {
|
|
1294
|
+
type: "approximate";
|
|
1295
|
+
city?: string;
|
|
1296
|
+
region?: string;
|
|
1297
|
+
country?: string;
|
|
1298
|
+
timezone?: string;
|
|
1299
|
+
};
|
|
1300
|
+
responseInclusion?: "full" | "excluded";
|
|
1301
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.ProviderExecutedTool<{
|
|
1302
|
+
query: string;
|
|
1303
|
+
}, {
|
|
1304
|
+
type: "web_search_result";
|
|
1305
|
+
url: string;
|
|
1306
|
+
title: string | null;
|
|
1307
|
+
pageAge: string | null;
|
|
1308
|
+
encryptedContent: string;
|
|
1309
|
+
}[], {}>;
|
|
1206
1310
|
/**
|
|
1207
1311
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
1208
1312
|
*
|
|
@@ -1268,6 +1372,8 @@ interface AnthropicProvider extends ProviderV4 {
|
|
|
1268
1372
|
languageModel(modelId: AnthropicModelId): LanguageModelV4;
|
|
1269
1373
|
chat(modelId: AnthropicModelId): LanguageModelV4;
|
|
1270
1374
|
messages(modelId: AnthropicModelId): LanguageModelV4;
|
|
1375
|
+
/** Creates an experimental Choice/Score/Boolean evaluation model using Messages. */
|
|
1376
|
+
evaluationModel(modelId: AnthropicModelId): Experimental_EvaluationModelV4;
|
|
1271
1377
|
experimental_batch(): Experimental_BatchV4<{
|
|
1272
1378
|
text: AnthropicModelId;
|
|
1273
1379
|
}>;
|