@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/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  } from "@ai-sdk/provider-utils";
13
13
 
14
14
  // src/version.ts
15
- var VERSION = true ? "3.0.63" : "0.0.0-test";
15
+ var VERSION = true ? "3.0.64" : "0.0.0-test";
16
16
 
17
17
  // src/anthropic-messages-language-model.ts
18
18
  import {
@@ -864,6 +864,20 @@ var anthropicLanguageModelOptions = z3.object({
864
864
  type: z3.literal("ephemeral"),
865
865
  ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
866
866
  }).optional(),
867
+ /**
868
+ * Metadata to include with the request.
869
+ *
870
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
871
+ */
872
+ metadata: z3.object({
873
+ /**
874
+ * An external identifier for the user associated with the request.
875
+ *
876
+ * Should be a UUID, hash value, or other opaque identifier.
877
+ * Must not contain PII (name, email, phone number, etc.).
878
+ */
879
+ userId: z3.string().optional()
880
+ }).optional(),
867
881
  /**
868
882
  * MCP servers to be utilized in this request.
869
883
  */
@@ -2915,7 +2929,7 @@ var AnthropicMessagesLanguageModel = class {
2915
2929
  providerOptions,
2916
2930
  stream
2917
2931
  }) {
2918
- var _a, _b, _c, _d, _e, _f, _g, _h;
2932
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2919
2933
  const warnings = [];
2920
2934
  if (frequencyPenalty != null) {
2921
2935
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -3053,6 +3067,9 @@ var AnthropicMessagesLanguageModel = class {
3053
3067
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
3054
3068
  cache_control: anthropicOptions.cacheControl
3055
3069
  },
3070
+ ...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
3071
+ metadata: { user_id: anthropicOptions.metadata.userId }
3072
+ },
3056
3073
  // mcp servers:
3057
3074
  ...(anthropicOptions == null ? void 0 : anthropicOptions.mcpServers) && anthropicOptions.mcpServers.length > 0 && {
3058
3075
  mcp_servers: anthropicOptions.mcpServers.map((server) => ({
@@ -3223,7 +3240,7 @@ var AnthropicMessagesLanguageModel = class {
3223
3240
  if ((anthropicOptions == null ? void 0 : anthropicOptions.speed) === "fast") {
3224
3241
  betas.add("fast-mode-2026-02-01");
3225
3242
  }
3226
- if (stream && ((_g = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _g : true)) {
3243
+ if (stream && ((_h = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _h : true)) {
3227
3244
  betas.add("fine-grained-tool-streaming-2025-05-14");
3228
3245
  }
3229
3246
  const {
@@ -3262,7 +3279,7 @@ var AnthropicMessagesLanguageModel = class {
3262
3279
  ...betas,
3263
3280
  ...toolsBetas,
3264
3281
  ...userSuppliedBetas,
3265
- ...(_h = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _h : []
3282
+ ...(_i = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _i : []
3266
3283
  ]),
3267
3284
  usesJsonResponseTool: jsonResponseTool != null,
3268
3285
  toolNameMapping,