@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/CHANGELOG.md
CHANGED
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -15,6 +15,14 @@ declare const anthropicProviderOptions: z.ZodObject<{
|
|
|
15
15
|
type: z.ZodLiteral<"ephemeral">;
|
|
16
16
|
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
17
17
|
}, z.core.$strip>>;
|
|
18
|
+
container: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
id: z.ZodOptional<z.ZodString>;
|
|
20
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"anthropic">, z.ZodLiteral<"custom">]>;
|
|
22
|
+
skillId: z.ZodString;
|
|
23
|
+
version: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>>>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
18
26
|
}, z.core.$strip>;
|
|
19
27
|
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
20
28
|
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,14 @@ declare const anthropicProviderOptions: z.ZodObject<{
|
|
|
15
15
|
type: z.ZodLiteral<"ephemeral">;
|
|
16
16
|
ttl: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"5m">, z.ZodLiteral<"1h">]>>;
|
|
17
17
|
}, z.core.$strip>>;
|
|
18
|
+
container: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
id: z.ZodOptional<z.ZodString>;
|
|
20
|
+
skills: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"anthropic">, z.ZodLiteral<"custom">]>;
|
|
22
|
+
skillId: z.ZodString;
|
|
23
|
+
version: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>>>;
|
|
25
|
+
}, z.core.$strip>>;
|
|
18
26
|
}, z.core.$strip>;
|
|
19
27
|
type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
|
|
20
28
|
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
31
31
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/version.ts
|
|
34
|
-
var VERSION = true ? "2.0.
|
|
34
|
+
var VERSION = true ? "2.0.32" : "0.0.0-test";
|
|
35
35
|
|
|
36
36
|
// src/anthropic-messages-language-model.ts
|
|
37
37
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -543,6 +543,21 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
543
543
|
cacheControl: import_v43.z.object({
|
|
544
544
|
type: import_v43.z.literal("ephemeral"),
|
|
545
545
|
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
|
|
546
|
+
}).optional(),
|
|
547
|
+
/**
|
|
548
|
+
* Agent Skills configuration. Skills enable Claude to perform specialized tasks
|
|
549
|
+
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
550
|
+
* Requires code execution tool to be enabled.
|
|
551
|
+
*/
|
|
552
|
+
container: import_v43.z.object({
|
|
553
|
+
id: import_v43.z.string().optional(),
|
|
554
|
+
skills: import_v43.z.array(
|
|
555
|
+
import_v43.z.object({
|
|
556
|
+
type: import_v43.z.union([import_v43.z.literal("anthropic"), import_v43.z.literal("custom")]),
|
|
557
|
+
skillId: import_v43.z.string(),
|
|
558
|
+
version: import_v43.z.string().optional()
|
|
559
|
+
})
|
|
560
|
+
).optional()
|
|
546
561
|
}).optional()
|
|
547
562
|
});
|
|
548
563
|
|
|
@@ -1649,7 +1664,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1649
1664
|
toolChoice,
|
|
1650
1665
|
providerOptions
|
|
1651
1666
|
}) {
|
|
1652
|
-
var _a, _b, _c;
|
|
1667
|
+
var _a, _b, _c, _d;
|
|
1653
1668
|
const warnings = [];
|
|
1654
1669
|
if (frequencyPenalty != null) {
|
|
1655
1670
|
warnings.push({
|
|
@@ -1695,7 +1710,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1695
1710
|
providerOptions,
|
|
1696
1711
|
schema: anthropicProviderOptions
|
|
1697
1712
|
});
|
|
1698
|
-
const { prompt: messagesPrompt, betas
|
|
1713
|
+
const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
|
|
1699
1714
|
prompt,
|
|
1700
1715
|
sendReasoning: (_a = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _a : true,
|
|
1701
1716
|
warnings
|
|
@@ -1717,6 +1732,17 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1717
1732
|
...isThinking && {
|
|
1718
1733
|
thinking: { type: "enabled", budget_tokens: thinkingBudget }
|
|
1719
1734
|
},
|
|
1735
|
+
// container with agent skills:
|
|
1736
|
+
...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
|
|
1737
|
+
container: {
|
|
1738
|
+
id: anthropicOptions.container.id,
|
|
1739
|
+
skills: (_d = anthropicOptions.container.skills) == null ? void 0 : _d.map((skill) => ({
|
|
1740
|
+
type: skill.type,
|
|
1741
|
+
skill_id: skill.skillId,
|
|
1742
|
+
version: skill.version
|
|
1743
|
+
}))
|
|
1744
|
+
}
|
|
1745
|
+
},
|
|
1720
1746
|
// prompt:
|
|
1721
1747
|
system: messagesPrompt.system,
|
|
1722
1748
|
messages: messagesPrompt.messages
|
|
@@ -1758,11 +1784,24 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1758
1784
|
warnings.push({
|
|
1759
1785
|
type: "unsupported-setting",
|
|
1760
1786
|
setting: "maxOutputTokens",
|
|
1761
|
-
details: `${
|
|
1787
|
+
details: `${baseArgs.max_tokens} (maxOutputTokens + thinkingBudget) is greater than ${this.modelId} ${maxOutputTokensForModel} max output tokens. The max output tokens have been limited to ${maxOutputTokensForModel}.`
|
|
1762
1788
|
});
|
|
1763
1789
|
}
|
|
1764
1790
|
baseArgs.max_tokens = maxOutputTokensForModel;
|
|
1765
1791
|
}
|
|
1792
|
+
if ((anthropicOptions == null ? void 0 : anthropicOptions.container) && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
|
|
1793
|
+
betas.add("code-execution-2025-08-25");
|
|
1794
|
+
betas.add("skills-2025-10-02");
|
|
1795
|
+
betas.add("files-api-2025-04-14");
|
|
1796
|
+
if (!(tools == null ? void 0 : tools.some(
|
|
1797
|
+
(tool) => tool.type === "provider-defined" && tool.id === "anthropic.code_execution_20250825"
|
|
1798
|
+
))) {
|
|
1799
|
+
warnings.push({
|
|
1800
|
+
type: "other",
|
|
1801
|
+
message: "code execution tool is required when using skills"
|
|
1802
|
+
});
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1766
1805
|
const {
|
|
1767
1806
|
tools: anthropicTools2,
|
|
1768
1807
|
toolChoice: anthropicToolChoice,
|
|
@@ -1786,7 +1825,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1786
1825
|
tool_choice: anthropicToolChoice
|
|
1787
1826
|
},
|
|
1788
1827
|
warnings: [...warnings, ...toolWarnings],
|
|
1789
|
-
betas: /* @__PURE__ */ new Set([...
|
|
1828
|
+
betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas]),
|
|
1790
1829
|
usesJsonResponseTool: jsonResponseTool != null
|
|
1791
1830
|
};
|
|
1792
1831
|
}
|