@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.
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  } from "@ai-sdk/provider-utils";
12
12
 
13
13
  // src/version.ts
14
- var VERSION = true ? "2.0.69" : "0.0.0-test";
14
+ var VERSION = true ? "2.0.71" : "0.0.0-test";
15
15
 
16
16
  // src/anthropic-messages-language-model.ts
17
17
  import {
@@ -668,6 +668,20 @@ var anthropicProviderOptions = z3.object({
668
668
  type: z3.literal("ephemeral"),
669
669
  ttl: z3.union([z3.literal("5m"), z3.literal("1h")]).optional()
670
670
  }).optional(),
671
+ /**
672
+ * Metadata to include with the request.
673
+ *
674
+ * See https://platform.claude.com/docs/en/api/messages/create for details.
675
+ */
676
+ metadata: z3.object({
677
+ /**
678
+ * An external identifier for the user associated with the request.
679
+ *
680
+ * Should be a UUID, hash value, or other opaque identifier.
681
+ * Must not contain PII (name, email, phone number, etc.).
682
+ */
683
+ userId: z3.string().optional()
684
+ }).optional(),
671
685
  /**
672
686
  * Agent Skills configuration. Skills enable Claude to perform specialized tasks
673
687
  * like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
@@ -953,6 +967,7 @@ async function prepareTools({
953
967
  disableParallelToolUse,
954
968
  cacheControlValidator
955
969
  }) {
970
+ var _a;
956
971
  tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
957
972
  const toolWarnings = [];
958
973
  const betas = /* @__PURE__ */ new Set();
@@ -968,11 +983,14 @@ async function prepareTools({
968
983
  type: "tool definition",
969
984
  canCache: true
970
985
  });
986
+ const anthropicOptions = (_a = tool.providerOptions) == null ? void 0 : _a.anthropic;
987
+ const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
971
988
  anthropicTools2.push({
972
989
  name: tool.name,
973
990
  description: tool.description,
974
991
  input_schema: tool.inputSchema,
975
- cache_control: cacheControl
992
+ cache_control: cacheControl,
993
+ ...eagerInputStreaming ? { eager_input_streaming: true } : {}
976
994
  });
977
995
  break;
978
996
  }
@@ -1966,7 +1984,7 @@ var AnthropicMessagesLanguageModel = class {
1966
1984
  toolChoice,
1967
1985
  providerOptions
1968
1986
  }) {
1969
- var _a, _b, _c, _d, _e, _f;
1987
+ var _a, _b, _c, _d, _e, _f, _g;
1970
1988
  const warnings = [];
1971
1989
  if (frequencyPenalty != null) {
1972
1990
  warnings.push({
@@ -2070,6 +2088,9 @@ var AnthropicMessagesLanguageModel = class {
2070
2088
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
2071
2089
  cache_control: anthropicOptions.cacheControl
2072
2090
  },
2091
+ ...((_e = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _e.userId) != null && {
2092
+ metadata: { user_id: anthropicOptions.metadata.userId }
2093
+ },
2073
2094
  // structured output:
2074
2095
  ...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
2075
2096
  output_format: {
@@ -2081,7 +2102,7 @@ var AnthropicMessagesLanguageModel = class {
2081
2102
  ...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
2082
2103
  container: {
2083
2104
  id: anthropicOptions.container.id,
2084
- skills: (_e = anthropicOptions.container.skills) == null ? void 0 : _e.map((skill) => ({
2105
+ skills: (_f = anthropicOptions.container.skills) == null ? void 0 : _f.map((skill) => ({
2085
2106
  type: skill.type,
2086
2107
  skill_id: skill.skillId,
2087
2108
  version: skill.version
@@ -2244,7 +2265,7 @@ var AnthropicMessagesLanguageModel = class {
2244
2265
  ...betas,
2245
2266
  ...toolsBetas,
2246
2267
  ...userSuppliedBetas,
2247
- ...(_f = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _f : []
2268
+ ...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
2248
2269
  ]),
2249
2270
  usesJsonResponseTool: jsonResponseTool != null
2250
2271
  };