@ai-sdk/anthropic 2.0.69 → 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.
@@ -653,6 +653,20 @@ var anthropicProviderOptions = z3.object({
653
653
  type: z3.literal("ephemeral"),
654
654
  ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
655
655
  }).optional(),
656
+ /**
657
+ * Metadata to include with the request.
658
+ *
659
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
660
+ */
661
+ metadata: z3.object({
662
+ /**
663
+ * An external identifier for the user associated with the request.
664
+ *
665
+ * Should be a UUID, hash value, or other opaque identifier.
666
+ * Must not contain PII (name, email, phone number, etc.).
667
+ */
668
+ userId: z3.string().optional()
669
+ }).optional(),
656
670
  /**
657
671
  * Agent Skills configuration. Skills enable Claude to perform specialized tasks
658
672
  * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
@@ -938,6 +952,7 @@ async function prepareTools({
938
952
  disableParallelToolUse,
939
953
  cacheControlValidator
940
954
  }) {
955
+ var _a;
941
956
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
942
957
  const toolWarnings = [];
943
958
  const betas = /* @__PURE__ */ new Set();
@@ -953,11 +968,14 @@ async function prepareTools({
953
968
  type: "tool definition",
954
969
  canCache: true
955
970
  });
971
+ const anthropicOptions = (_a = tool.providerOptions) == null ? void 0 : _a.anthropic;
972
+ const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
956
973
  anthropicTools2.push({
957
974
  name: tool.name,
958
975
  description: tool.description,
959
976
  input_schema: tool.inputSchema,
960
- cache_control: cacheControl
977
+ cache_control: cacheControl,
978
+ ...eagerInputStreaming ? { eager_input_streaming: true } : {}
961
979
  });
962
980
  break;
963
981
  }
@@ -1951,7 +1969,7 @@ var AnthropicMessagesLanguageModel = class {
1951
1969
  toolChoice,
1952
1970
  providerOptions
1953
1971
  }) {
1954
- var _a, _b, _c, _d, _e, _f;
1972
+ var _a, _b, _c, _d, _e, _f, _g;
1955
1973
  const warnings = [];
1956
1974
  if (frequencyPenalty != null) {
1957
1975
  warnings.push({
@@ -2055,6 +2073,9 @@ var AnthropicMessagesLanguageModel = class {
2055
2073
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
2056
2074
  cache_control: anthropicOptions.cacheControl
2057
2075
  },
2076
+ ...((_e = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _e.userId) != null && {
2077
+ metadata: { user_id: anthropicOptions.metadata.userId }
2078
+ },
2058
2079
  // structured output:
2059
2080
  ...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
2060
2081
  output_format: {
@@ -2066,7 +2087,7 @@ var AnthropicMessagesLanguageModel = class {
2066
2087
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
2067
2088
  container: {
2068
2089
  id: anthropicOptions.container.id,
2069
- skills: (_e = anthropicOptions.container.skills) == null ? void 0 : _e.map((skill) => ({
2090
+ skills: (_f = anthropicOptions.container.skills) == null ? void 0 : _f.map((skill) => ({
2070
2091
  type: skill.type,
2071
2092
  skill_id: skill.skillId,
2072
2093
  version: skill.version
@@ -2229,7 +2250,7 @@ var AnthropicMessagesLanguageModel = class {
2229
2250
  ...betas,
2230
2251
  ...toolsBetas,
2231
2252
  ...userSuppliedBetas,
2232
- ...(_f = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _f : []
2253
+ ...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
2233
2254
  ]),
2234
2255
  usesJsonResponseTool: jsonResponseTool != null
2235
2256
  };