@ai-sdk/anthropic 4.0.53 → 4.0.55
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 +22 -0
- package/dist/index.d.ts +104 -0
- package/dist/index.js +657 -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 +42 -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-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,27 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 4.0.55
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 132bdae: feat(anthropic): add 20260318 web search and web fetch tools with response inclusion controls
|
|
8
|
+
- Updated dependencies [91c2128]
|
|
9
|
+
- Updated dependencies [2cd80b3]
|
|
10
|
+
- Updated dependencies [d06bb2a]
|
|
11
|
+
- Updated dependencies [123d71f]
|
|
12
|
+
- Updated dependencies [2fa5e0e]
|
|
13
|
+
- @ai-sdk/provider-utils@5.0.42
|
|
14
|
+
- @ai-sdk/provider@4.0.16
|
|
15
|
+
|
|
16
|
+
## 4.0.54
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [5c0054d]
|
|
21
|
+
- Updated dependencies [39535af]
|
|
22
|
+
- @ai-sdk/provider@4.0.15
|
|
23
|
+
- @ai-sdk/provider-utils@5.0.41
|
|
24
|
+
|
|
3
25
|
## 4.0.53
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -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
|
*
|