@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.
@@ -522,6 +522,21 @@ var anthropicProviderOptions = z3.object({
522
522
  cacheControl: z3.object({
523
523
  type: z3.literal("ephemeral"),
524
524
  ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
525
+ }).optional(),
526
+ /**
527
+ * Agent Skills configuration. Skills enable Claude to perform specialized tasks
528
+ * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
529
+ * Requires code execution tool to be enabled.
530
+ */
531
+ container: z3.object({
532
+ id: z3.string().optional(),
533
+ skills: z3.array(
534
+ z3.object({
535
+ type: z3.union([z3.literal("anthropic"), z3.literal("custom")]),
536
+ skillId: z3.string(),
537
+ version: z3.string().optional()
538
+ })
539
+ ).optional()
525
540
  }).optional()
526
541
  });
527
542
 
@@ -1652,7 +1667,7 @@ var AnthropicMessagesLanguageModel = class {
1652
1667
  toolChoice,
1653
1668
  providerOptions
1654
1669
  }) {
1655
- var _a, _b, _c;
1670
+ var _a, _b, _c, _d;
1656
1671
  const warnings = [];
1657
1672
  if (frequencyPenalty != null) {
1658
1673
  warnings.push({
@@ -1698,7 +1713,7 @@ var AnthropicMessagesLanguageModel = class {
1698
1713
  providerOptions,
1699
1714
  schema: anthropicProviderOptions
1700
1715
  });
1701
- const { prompt: messagesPrompt, betas: messagesBetas } = await convertToAnthropicMessagesPrompt({
1716
+ const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
1702
1717
  prompt,
1703
1718
  sendReasoning: (_a = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _a : true,
1704
1719
  warnings
@@ -1720,6 +1735,17 @@ var AnthropicMessagesLanguageModel = class {
1720
1735
  ...isThinking && {
1721
1736
  thinking: { type: "enabled", budget_tokens: thinkingBudget }
1722
1737
  },
1738
+ // container with agent skills:
1739
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
1740
+ container: {
1741
+ id: anthropicOptions.container.id,
1742
+ skills: (_d = anthropicOptions.container.skills) == null ? void 0 : _d.map((skill) => ({
1743
+ type: skill.type,
1744
+ skill_id: skill.skillId,
1745
+ version: skill.version
1746
+ }))
1747
+ }
1748
+ },
1723
1749
  // prompt:
1724
1750
  system: messagesPrompt.system,
1725
1751
  messages: messagesPrompt.messages
@@ -1761,11 +1787,24 @@ var AnthropicMessagesLanguageModel = class {
1761
1787
  warnings.push({
1762
1788
  type: "unsupported-setting",
1763
1789
  setting: "maxOutputTokens",
1764
- details: `${maxTokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. The max output tokens have been limited to ${maxOutputTokensForModel}.`
1790
+ details: `${baseArgs.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. The max output tokens have been limited to ${maxOutputTokensForModel}.`
1765
1791
  });
1766
1792
  }
1767
1793
  baseArgs.max_tokens = maxOutputTokensForModel;
1768
1794
  }
1795
+ if ((anthropicOptions == null ? void 0 : anthropicOptions.container) && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
1796
+ betas.add("code-execution-2025-08-25");
1797
+ betas.add("skills-2025-10-02");
1798
+ betas.add("files-api-2025-04-14");
1799
+ if (!(tools == null ? void 0 : tools.some(
1800
+ (tool) => tool.type === "provider-defined" && tool.id === "anthropic.code_execution_20250825"
1801
+ ))) {
1802
+ warnings.push({
1803
+ type: "other",
1804
+ message: "code execution tool is required when using skills"
1805
+ });
1806
+ }
1807
+ }
1769
1808
  const {
1770
1809
  tools: anthropicTools2,
1771
1810
  toolChoice: anthropicToolChoice,
@@ -1789,7 +1828,7 @@ var AnthropicMessagesLanguageModel = class {
1789
1828
  tool_choice: anthropicToolChoice
1790
1829
  },
1791
1830
  warnings: [...warnings, ...toolWarnings],
1792
- betas: /* @__PURE__ */ new Set([...messagesBetas, ...toolsBetas]),
1831
+ betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas]),
1793
1832
  usesJsonResponseTool: jsonResponseTool != null
1794
1833
  };
1795
1834
  }