@ai-sdk/anthropic 3.0.63 → 3.0.64
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 +10 -4
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +20 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +20 -3
- package/dist/internal/index.mjs.map +1 -1
- package/docs/05-anthropic.mdx +6 -0
- package/package.json +1 -3
- package/src/anthropic-messages-language-model.ts +3 -0
- package/src/anthropic-messages-options.ts +17 -0
package/dist/internal/index.mjs
CHANGED
|
@@ -848,6 +848,20 @@ var anthropicLanguageModelOptions = z3.object({
|
|
|
848
848
|
type: z3.literal("ephemeral"),
|
|
849
849
|
ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
|
|
850
850
|
}).optional(),
|
|
851
|
+
/**
|
|
852
|
+
* Metadata to include with the request.
|
|
853
|
+
*
|
|
854
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
855
|
+
*/
|
|
856
|
+
metadata: z3.object({
|
|
857
|
+
/**
|
|
858
|
+
* An external identifier for the user associated with the request.
|
|
859
|
+
*
|
|
860
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
861
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
862
|
+
*/
|
|
863
|
+
userId: z3.string().optional()
|
|
864
|
+
}).optional(),
|
|
851
865
|
/**
|
|
852
866
|
* MCP servers to be utilized in this request.
|
|
853
867
|
*/
|
|
@@ -2899,7 +2913,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2899
2913
|
providerOptions,
|
|
2900
2914
|
stream
|
|
2901
2915
|
}) {
|
|
2902
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2916
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2903
2917
|
const warnings = [];
|
|
2904
2918
|
if (frequencyPenalty != null) {
|
|
2905
2919
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -3037,6 +3051,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3037
3051
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
3038
3052
|
cache_control: anthropicOptions.cacheControl
|
|
3039
3053
|
},
|
|
3054
|
+
...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
|
|
3055
|
+
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
3056
|
+
},
|
|
3040
3057
|
// mcp servers:
|
|
3041
3058
|
...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
|
|
3042
3059
|
mcp_servers: anthropicOptions.mcpServers.map((server) => ({
|
|
@@ -3207,7 +3224,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3207
3224
|
if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
|
|
3208
3225
|
betas.add("fast-mode-2026-02-01");
|
|
3209
3226
|
}
|
|
3210
|
-
if (stream && ((
|
|
3227
|
+
if (stream && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _h : true)) {
|
|
3211
3228
|
betas.add("fine-grained-tool-streaming-2025-05-14");
|
|
3212
3229
|
}
|
|
3213
3230
|
const {
|
|
@@ -3246,7 +3263,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3246
3263
|
...betas,
|
|
3247
3264
|
...toolsBetas,
|
|
3248
3265
|
...userSuppliedBetas,
|
|
3249
|
-
...(
|
|
3266
|
+
...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
|
|
3250
3267
|
]),
|
|
3251
3268
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
3252
3269
|
toolNameMapping,
|