@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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +44 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +43 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +43 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.js
CHANGED
|
@@ -536,6 +536,21 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
536
536
|
cacheControl: import_v43.z.object({
|
|
537
537
|
type: import_v43.z.literal("ephemeral"),
|
|
538
538
|
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.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: import_v43.z.object({
|
|
546
|
+
id: import_v43.z.string().optional(),
|
|
547
|
+
skills: import_v43.z.array(
|
|
548
|
+
import_v43.z.object({
|
|
549
|
+
type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
|
|
550
|
+
skillId: import_v43.z.string(),
|
|
551
|
+
version: import_v43.z.string().optional()
|
|
552
|
+
})
|
|
553
|
+
).optional()
|
|
539
554
|
}).optional()
|
|
540
555
|
});
|
|
541
556
|
|
|
@@ -1642,7 +1657,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1642
1657
|
toolChoice,
|
|
1643
1658
|
providerOptions
|
|
1644
1659
|
}) {
|
|
1645
|
-
var _a, _b, _c;
|
|
1660
|
+
var _a, _b, _c, _d;
|
|
1646
1661
|
const warnings = [];
|
|
1647
1662
|
if (frequencyPenalty != null) {
|
|
1648
1663
|
warnings.push({
|
|
@@ -1688,7 +1703,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1688
1703
|
providerOptions,
|
|
1689
1704
|
schema: anthropicProviderOptions
|
|
1690
1705
|
});
|
|
1691
|
-
const { prompt: messagesPrompt, betas
|
|
1706
|
+
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
1692
1707
|
prompt,
|
|
1693
1708
|
sendReasoning: (_a = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _a : true,
|
|
1694
1709
|
warnings
|
|
@@ -1710,6 +1725,17 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1710
1725
|
...isThinking && {
|
|
1711
1726
|
thinking: { type: "enabled", budget_tokens: thinkingBudget }
|
|
1712
1727
|
},
|
|
1728
|
+
// container with agent skills:
|
|
1729
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
|
|
1730
|
+
container: {
|
|
1731
|
+
id: anthropicOptions.container.id,
|
|
1732
|
+
skills: (_d = anthropicOptions.container.skills) == null ? void 0 : _d.map((skill) => ({
|
|
1733
|
+
type: skill.type,
|
|
1734
|
+
skill_id: skill.skillId,
|
|
1735
|
+
version: skill.version
|
|
1736
|
+
}))
|
|
1737
|
+
}
|
|
1738
|
+
},
|
|
1713
1739
|
// prompt:
|
|
1714
1740
|
system: messagesPrompt.system,
|
|
1715
1741
|
messages: messagesPrompt.messages
|
|
@@ -1751,11 +1777,24 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1751
1777
|
warnings.push({
|
|
1752
1778
|
type: "unsupported-setting",
|
|
1753
1779
|
setting: "maxOutputTokens",
|
|
1754
|
-
details: `${
|
|
1780
|
+
details: `${baseArgs.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. The max output tokens have been limited to ${maxOutputTokensForModel}.`
|
|
1755
1781
|
});
|
|
1756
1782
|
}
|
|
1757
1783
|
baseArgs.max_tokens = maxOutputTokensForModel;
|
|
1758
1784
|
}
|
|
1785
|
+
if ((anthropicOptions == null ? void 0 : anthropicOptions.container) && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
|
|
1786
|
+
betas.add("code-execution-2025-08-25");
|
|
1787
|
+
betas.add("skills-2025-10-02");
|
|
1788
|
+
betas.add("files-api-2025-04-14");
|
|
1789
|
+
if (!(tools == null ? void 0 : tools.some(
|
|
1790
|
+
(tool) => tool.type === "provider-defined" && tool.id === "anthropic.code_execution_20250825"
|
|
1791
|
+
))) {
|
|
1792
|
+
warnings.push({
|
|
1793
|
+
type: "other",
|
|
1794
|
+
message: "code execution tool is required when using skills"
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1759
1798
|
const {
|
|
1760
1799
|
tools: anthropicTools2,
|
|
1761
1800
|
toolChoice: anthropicToolChoice,
|
|
@@ -1779,7 +1818,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1779
1818
|
tool_choice: anthropicToolChoice
|
|
1780
1819
|
},
|
|
1781
1820
|
warnings: [...warnings, ...toolWarnings],
|
|
1782
|
-
betas: /* @__PURE__ */ new Set([...
|
|
1821
|
+
betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas]),
|
|
1783
1822
|
usesJsonResponseTool: jsonResponseTool != null
|
|
1784
1823
|
};
|
|
1785
1824
|
}
|