@ai-sdk/anthropic 2.0.70 → 2.0.71

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.
@@ -18,13 +18,13 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/internal/index.ts
21
- var internal_exports = {};
22
- __export(internal_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  AnthropicMessagesLanguageModel: () => AnthropicMessagesLanguageModel,
24
24
  anthropicTools: () => anthropicTools,
25
25
  prepareTools: () => prepareTools
26
26
  });
27
- module.exports = __toCommonJS(internal_exports);
27
+ module.exports = __toCommonJS(index_exports);
28
28
 
29
29
  // src/anthropic-messages-language-model.ts
30
30
  var import_provider3 = require("@ai-sdk/provider");
@@ -666,6 +666,20 @@ var anthropicProviderOptions = import_v43.z.object({
666
666
  type: import_v43.z.literal("ephemeral"),
667
667
  ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
668
668
  }).optional(),
669
+ /**
670
+ * Metadata to include with the request.
671
+ *
672
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
673
+ */
674
+ metadata: import_v43.z.object({
675
+ /**
676
+ * An external identifier for the user associated with the request.
677
+ *
678
+ * Should be a UUID, hash value, or other opaque identifier.
679
+ * Must not contain PII (name, email, phone number, etc.).
680
+ */
681
+ userId: import_v43.z.string().optional()
682
+ }).optional(),
669
683
  /**
670
684
  * Agent Skills configuration. Skills enable Claude to perform specialized tasks
671
685
  * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
@@ -1944,7 +1958,7 @@ var AnthropicMessagesLanguageModel = class {
1944
1958
  toolChoice,
1945
1959
  providerOptions
1946
1960
  }) {
1947
- var _a, _b, _c, _d, _e, _f;
1961
+ var _a, _b, _c, _d, _e, _f, _g;
1948
1962
  const warnings = [];
1949
1963
  if (frequencyPenalty != null) {
1950
1964
  warnings.push({
@@ -2048,6 +2062,9 @@ var AnthropicMessagesLanguageModel = class {
2048
2062
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
2049
2063
  cache_control: anthropicOptions.cacheControl
2050
2064
  },
2065
+ ...((_e = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _e.userId) != null && {
2066
+ metadata: { user_id: anthropicOptions.metadata.userId }
2067
+ },
2051
2068
  // structured output:
2052
2069
  ...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
2053
2070
  output_format: {
@@ -2059,7 +2076,7 @@ var AnthropicMessagesLanguageModel = class {
2059
2076
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
2060
2077
  container: {
2061
2078
  id: anthropicOptions.container.id,
2062
- skills: (_e = anthropicOptions.container.skills) == null ? void 0 : _e.map((skill) => ({
2079
+ skills: (_f = anthropicOptions.container.skills) == null ? void 0 : _f.map((skill) => ({
2063
2080
  type: skill.type,
2064
2081
  skill_id: skill.skillId,
2065
2082
  version: skill.version
@@ -2222,7 +2239,7 @@ var AnthropicMessagesLanguageModel = class {
2222
2239
  ...betas,
2223
2240
  ...toolsBetas,
2224
2241
  ...userSuppliedBetas,
2225
- ...(_f = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _f : []
2242
+ ...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
2226
2243
  ]),
2227
2244
  usesJsonResponseTool: jsonResponseTool != null
2228
2245
  };