@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/dist/index.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  } from "@ai-sdk/provider-utils";
11
11
 
12
12
  // src/version.ts
13
- var VERSION = true ? "3.0.0-beta.28" : "0.0.0-test";
13
+ var VERSION = true ? "3.0.0-beta.30" : "0.0.0-test";
14
14
 
15
15
  // src/anthropic-messages-language-model.ts
16
16
  import {
@@ -584,7 +584,22 @@ var anthropicProviderOptions = z3.object({
584
584
  allowedTools: z3.array(z3.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: z3.object({
594
+ id: z3.string().optional(),
595
+ skills: z3.array(
596
+ z3.object({
597
+ type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
598
+ skillId: z3.string(),
599
+ version: z3.string().optional()
600
+ })
601
+ ).optional()
602
+ }).optional()
588
603
  });
589
604
 
590
605
  // src/anthropic-prepare-tools.ts
@@ -977,7 +992,8 @@ import {
977
992
  import {
978
993
  convertToBase64,
979
994
  parseProviderOptions,
980
- validateTypes as validateTypes2
995
+ validateTypes as validateTypes2,
996
+ isNonNullable
981
997
  } from "@ai-sdk/provider-utils";
982
998
 
983
999
  // src/tool/code-execution_20250522.ts
@@ -1280,20 +1296,20 @@ async function convertToAnthropicMessagesPrompt({
1280
1296
  return {
1281
1297
  type: "text",
1282
1298
  text: contentPart.text,
1283
- cache_control: void 0
1299
+ cache_control: cacheControl
1284
1300
  };
1285
- case "media": {
1286
- if (contentPart.mediaType.startsWith("image/")) {
1287
- return {
1288
- type: "image",
1289
- source: {
1290
- type: "base64",
1291
- media_type: contentPart.mediaType,
1292
- data: contentPart.data
1293
- },
1294
- cache_control: void 0
1295
- };
1296
- }
1301
+ case "image-data": {
1302
+ return {
1303
+ type: "image",
1304
+ source: {
1305
+ type: "base64",
1306
+ media_type: contentPart.mediaType,
1307
+ data: contentPart.data
1308
+ },
1309
+ cache_control: cacheControl
1310
+ };
1311
+ }
1312
+ case "file-data": {
1297
1313
  if (contentPart.mediaType === "application/pdf") {
1298
1314
  betas.add("pdfs-2024-09-25");
1299
1315
  return {
@@ -1303,15 +1319,24 @@ async function convertToAnthropicMessagesPrompt({
1303
1319
  media_type: contentPart.mediaType,
1304
1320
  data: contentPart.data
1305
1321
  },
1306
- cache_control: void 0
1322
+ cache_control: cacheControl
1307
1323
  };
1308
1324
  }
1309
- throw new UnsupportedFunctionalityError2({
1310
- functionality: `media type: ${contentPart.mediaType}`
1325
+ warnings.push({
1326
+ type: "other",
1327
+ message: `unsupported tool content part type: ${contentPart.type} with media type: ${contentPart.mediaType}`
1328
+ });
1329
+ return void 0;
1330
+ }
1331
+ default: {
1332
+ warnings.push({
1333
+ type: "other",
1334
+ message: `unsupported tool content part type: ${contentPart.type}`
1311
1335
  });
1336
+ return void 0;
1312
1337
  }
1313
1338
  }
1314
- });
1339
+ }).filter(isNonNullable);
1315
1340
  break;
1316
1341
  case "text":
1317
1342
  case "error-text":
@@ -1756,7 +1781,7 @@ var AnthropicMessagesLanguageModel = class {
1756
1781
  toolChoice,
1757
1782
  providerOptions
1758
1783
  }) {
1759
- var _a, _b, _c;
1784
+ var _a, _b, _c, _d;
1760
1785
  const warnings = [];
1761
1786
  if (frequencyPenalty != null) {
1762
1787
  warnings.push({
@@ -1837,6 +1862,17 @@ var AnthropicMessagesLanguageModel = class {
1837
1862
  } : void 0
1838
1863
  }))
1839
1864
  },
1865
+ // container with agent skills:
1866
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
1867
+ container: {
1868
+ id: anthropicOptions.container.id,
1869
+ skills: (_d = anthropicOptions.container.skills) == null ? void 0 : _d.map((skill) => ({
1870
+ type: skill.type,
1871
+ skill_id: skill.skillId,
1872
+ version: skill.version
1873
+ }))
1874
+ }
1875
+ },
1840
1876
  // prompt:
1841
1877
  system: messagesPrompt.system,
1842
1878
  messages: messagesPrompt.messages
@@ -1886,6 +1922,19 @@ var AnthropicMessagesLanguageModel = class {
1886
1922
  if ((anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0) {
1887
1923
  betas.add("mcp-client-2025-04-04");
1888
1924
  }
1925
+ if ((anthropicOptions == null ? void 0 : anthropicOptions.container) && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
1926
+ betas.add("code-execution-2025-08-25");
1927
+ betas.add("skills-2025-10-02");
1928
+ betas.add("files-api-2025-04-14");
1929
+ if (!(tools == null ? void 0 : tools.some(
1930
+ (tool) => tool.type === "provider-defined" && tool.id === "anthropic.code_execution_20250825"
1931
+ ))) {
1932
+ warnings.push({
1933
+ type: "other",
1934
+ message: "code execution tool is required when using skills"
1935
+ });
1936
+ }
1937
+ }
1889
1938
  const {
1890
1939
  tools: anthropicTools2,
1891
1940
  toolChoice: anthropicToolChoice,