@ai-sdk/anthropic 2.0.31 → 2.0.32

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 ? "2.0.31" : "0.0.0-test";
13
+ var VERSION = true ? "2.0.32" : "0.0.0-test";
14
14
 
15
15
  // src/anthropic-messages-language-model.ts
16
16
  import {
@@ -536,6 +536,21 @@ var anthropicProviderOptions = z3.object({
536
536
  cacheControl: z3.object({
537
537
  type: z3.literal("ephemeral"),
538
538
  ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
539
+ }).optional(),
540
+ /**
541
+ * Agent Skills configuration. Skills enable Claude to perform specialized tasks
542
+ * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
543
+ * Requires code execution tool to be enabled.
544
+ */
545
+ container: z3.object({
546
+ id: z3.string().optional(),
547
+ skills: z3.array(
548
+ z3.object({
549
+ type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
550
+ skillId: z3.string(),
551
+ version: z3.string().optional()
552
+ })
553
+ ).optional()
539
554
  }).optional()
540
555
  });
541
556
 
@@ -1666,7 +1681,7 @@ var AnthropicMessagesLanguageModel = class {
1666
1681
  toolChoice,
1667
1682
  providerOptions
1668
1683
  }) {
1669
- var _a, _b, _c;
1684
+ var _a, _b, _c, _d;
1670
1685
  const warnings = [];
1671
1686
  if (frequencyPenalty != null) {
1672
1687
  warnings.push({
@@ -1712,7 +1727,7 @@ var AnthropicMessagesLanguageModel = class {
1712
1727
  providerOptions,
1713
1728
  schema: anthropicProviderOptions
1714
1729
  });
1715
- const { prompt: messagesPrompt, betas: messagesBetas } = await convertToAnthropicMessagesPrompt({
1730
+ const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
1716
1731
  prompt,
1717
1732
  sendReasoning: (_a = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _a : true,
1718
1733
  warnings
@@ -1734,6 +1749,17 @@ var AnthropicMessagesLanguageModel = class {
1734
1749
  ...isThinking && {
1735
1750
  thinking: { type: "enabled", budget_tokens: thinkingBudget }
1736
1751
  },
1752
+ // container with agent skills:
1753
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
1754
+ container: {
1755
+ id: anthropicOptions.container.id,
1756
+ skills: (_d = anthropicOptions.container.skills) == null ? void 0 : _d.map((skill) => ({
1757
+ type: skill.type,
1758
+ skill_id: skill.skillId,
1759
+ version: skill.version
1760
+ }))
1761
+ }
1762
+ },
1737
1763
  // prompt:
1738
1764
  system: messagesPrompt.system,
1739
1765
  messages: messagesPrompt.messages
@@ -1775,11 +1801,24 @@ var AnthropicMessagesLanguageModel = class {
1775
1801
  warnings.push({
1776
1802
  type: "unsupported-setting",
1777
1803
  setting: "maxOutputTokens",
1778
- details: `${maxTokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. The max output tokens have been limited to ${maxOutputTokensForModel}.`
1804
+ details: `${baseArgs.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. The max output tokens have been limited to ${maxOutputTokensForModel}.`
1779
1805
  });
1780
1806
  }
1781
1807
  baseArgs.max_tokens = maxOutputTokensForModel;
1782
1808
  }
1809
+ if ((anthropicOptions == null ? void 0 : anthropicOptions.container) && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
1810
+ betas.add("code-execution-2025-08-25");
1811
+ betas.add("skills-2025-10-02");
1812
+ betas.add("files-api-2025-04-14");
1813
+ if (!(tools == null ? void 0 : tools.some(
1814
+ (tool) => tool.type === "provider-defined" && tool.id === "anthropic.code_execution_20250825"
1815
+ ))) {
1816
+ warnings.push({
1817
+ type: "other",
1818
+ message: "code execution tool is required when using skills"
1819
+ });
1820
+ }
1821
+ }
1783
1822
  const {
1784
1823
  tools: anthropicTools2,
1785
1824
  toolChoice: anthropicToolChoice,
@@ -1803,7 +1842,7 @@ var AnthropicMessagesLanguageModel = class {
1803
1842
  tool_choice: anthropicToolChoice
1804
1843
  },
1805
1844
  warnings: [...warnings, ...toolWarnings],
1806
- betas: /* @__PURE__ */ new Set([...messagesBetas, ...toolsBetas]),
1845
+ betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas]),
1807
1846
  usesJsonResponseTool: jsonResponseTool != null
1808
1847
  };
1809
1848
  }