@ai-sdk/anthropic 3.0.0-beta.28 → 3.0.0-beta.30
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 +15 -0
- package/README.md +1 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +68 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -21
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +67 -19
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +69 -20
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -584,7 +584,22 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
584
584
|
allowedTools: import_v43.z.array(import_v43.z.string()).nullish()
|
|
585
585
|
}).nullish()
|
|
586
586
|
})
|
|
587
|
-
).optional()
|
|
587
|
+
).optional(),
|
|
588
|
+
/**
|
|
589
|
+
* Agent Skills configuration. Skills enable Claude to perform specialized tasks
|
|
590
|
+
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
591
|
+
* Requires code execution tool to be enabled.
|
|
592
|
+
*/
|
|
593
|
+
container: import_v43.z.object({
|
|
594
|
+
id: import_v43.z.string().optional(),
|
|
595
|
+
skills: import_v43.z.array(
|
|
596
|
+
import_v43.z.object({
|
|
597
|
+
type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
|
|
598
|
+
skillId: import_v43.z.string(),
|
|
599
|
+
version: import_v43.z.string().optional()
|
|
600
|
+
})
|
|
601
|
+
).optional()
|
|
602
|
+
}).optional()
|
|
588
603
|
});
|
|
589
604
|
|
|
590
605
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1256,20 +1271,20 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1256
1271
|
return {
|
|
1257
1272
|
type: "text",
|
|
1258
1273
|
text: contentPart.text,
|
|
1259
|
-
cache_control:
|
|
1274
|
+
cache_control: cacheControl
|
|
1260
1275
|
};
|
|
1261
|
-
case "
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1276
|
+
case "image-data": {
|
|
1277
|
+
return {
|
|
1278
|
+
type: "image",
|
|
1279
|
+
source: {
|
|
1280
|
+
type: "base64",
|
|
1281
|
+
media_type: contentPart.mediaType,
|
|
1282
|
+
data: contentPart.data
|
|
1283
|
+
},
|
|
1284
|
+
cache_control: cacheControl
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
case "file-data": {
|
|
1273
1288
|
if (contentPart.mediaType === "application/pdf") {
|
|
1274
1289
|
betas.add("pdfs-2024-09-25");
|
|
1275
1290
|
return {
|
|
@@ -1279,15 +1294,24 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
1279
1294
|
media_type: contentPart.mediaType,
|
|
1280
1295
|
data: contentPart.data
|
|
1281
1296
|
},
|
|
1282
|
-
cache_control:
|
|
1297
|
+
cache_control: cacheControl
|
|
1283
1298
|
};
|
|
1284
1299
|
}
|
|
1285
|
-
|
|
1286
|
-
|
|
1300
|
+
warnings.push({
|
|
1301
|
+
type: "other",
|
|
1302
|
+
message: `unsupported tool content part type: ${contentPart.type} with media type: ${contentPart.mediaType}`
|
|
1303
|
+
});
|
|
1304
|
+
return void 0;
|
|
1305
|
+
}
|
|
1306
|
+
default: {
|
|
1307
|
+
warnings.push({
|
|
1308
|
+
type: "other",
|
|
1309
|
+
message: `unsupported tool content part type: ${contentPart.type}`
|
|
1287
1310
|
});
|
|
1311
|
+
return void 0;
|
|
1288
1312
|
}
|
|
1289
1313
|
}
|
|
1290
|
-
});
|
|
1314
|
+
}).filter(import_provider_utils10.isNonNullable);
|
|
1291
1315
|
break;
|
|
1292
1316
|
case "text":
|
|
1293
1317
|
case "error-text":
|
|
@@ -1732,7 +1756,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1732
1756
|
toolChoice,
|
|
1733
1757
|
providerOptions
|
|
1734
1758
|
}) {
|
|
1735
|
-
var _a, _b, _c;
|
|
1759
|
+
var _a, _b, _c, _d;
|
|
1736
1760
|
const warnings = [];
|
|
1737
1761
|
if (frequencyPenalty != null) {
|
|
1738
1762
|
warnings.push({
|
|
@@ -1813,6 +1837,17 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1813
1837
|
} : void 0
|
|
1814
1838
|
}))
|
|
1815
1839
|
},
|
|
1840
|
+
// container with agent skills:
|
|
1841
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
|
|
1842
|
+
container: {
|
|
1843
|
+
id: anthropicOptions.container.id,
|
|
1844
|
+
skills: (_d = anthropicOptions.container.skills) == null ? void 0 : _d.map((skill) => ({
|
|
1845
|
+
type: skill.type,
|
|
1846
|
+
skill_id: skill.skillId,
|
|
1847
|
+
version: skill.version
|
|
1848
|
+
}))
|
|
1849
|
+
}
|
|
1850
|
+
},
|
|
1816
1851
|
// prompt:
|
|
1817
1852
|
system: messagesPrompt.system,
|
|
1818
1853
|
messages: messagesPrompt.messages
|
|
@@ -1862,6 +1897,19 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1862
1897
|
if ((anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0) {
|
|
1863
1898
|
betas.add("mcp-client-2025-04-04");
|
|
1864
1899
|
}
|
|
1900
|
+
if ((anthropicOptions == null ? void 0 : anthropicOptions.container) && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
|
|
1901
|
+
betas.add("code-execution-2025-08-25");
|
|
1902
|
+
betas.add("skills-2025-10-02");
|
|
1903
|
+
betas.add("files-api-2025-04-14");
|
|
1904
|
+
if (!(tools == null ? void 0 : tools.some(
|
|
1905
|
+
(tool) => tool.type === "provider-defined" && tool.id === "anthropic.code_execution_20250825"
|
|
1906
|
+
))) {
|
|
1907
|
+
warnings.push({
|
|
1908
|
+
type: "other",
|
|
1909
|
+
message: "code execution tool is required when using skills"
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1865
1913
|
const {
|
|
1866
1914
|
tools: anthropicTools2,
|
|
1867
1915
|
toolChoice: anthropicToolChoice,
|