@ai-sdk/anthropic 3.0.137 → 3.0.139

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
@@ -1,6 +1,6 @@
1
1
  // src/anthropic-provider.ts
2
2
  import {
3
- InvalidArgumentError,
3
+ InvalidArgumentError as InvalidArgumentError2,
4
4
  NoSuchModelError
5
5
  } from "@ai-sdk/provider";
6
6
  import {
@@ -12,11 +12,12 @@ import {
12
12
  } from "@ai-sdk/provider-utils";
13
13
 
14
14
  // src/version.ts
15
- var VERSION = true ? "3.0.137" : "0.0.0-test";
15
+ var VERSION = true ? "3.0.139" : "0.0.0-test";
16
16
 
17
17
  // src/anthropic-messages-language-model.ts
18
18
  import {
19
19
  APICallError,
20
+ InvalidArgumentError,
20
21
  InvalidResponseDataError
21
22
  } from "@ai-sdk/provider";
22
23
  import {
@@ -928,17 +929,43 @@ var anthropicSystemMessageProviderOptions = lazySchema3(
928
929
  * initial system prompt). A system message carrying tool changes must come
929
930
  * right before an assistant message or at the end of the messages.
930
931
  *
931
- * Tools referenced by a `tool_addition` must be declared in the `tools`
932
- * option (typically with `deferLoading: true` so they are not loaded until
933
- * the addition surfaces them). The required
934
- * `mid-conversation-tool-changes-2026-07-01` beta is added automatically.
932
+ * A `tool_addition` either references a tool by `toolName` or defines it
933
+ * by value with `tool`:
934
+ * - By reference: the tool must be declared in the `tools` option
935
+ * (typically with `deferLoading: true` so it is not loaded until the
936
+ * addition surfaces it). The required
937
+ * `mid-conversation-tool-changes-2026-07-01` beta is added
938
+ * automatically.
939
+ * - By value: `tool` is a function or provider tool, in the same shape as
940
+ * an entry of the `tools` option. The tool does not need to be declared
941
+ * in `tools`, and defining a tool under an existing name replaces it
942
+ * from that point on. The required `inline-tools-2026-09-15` beta is
943
+ * added automatically.
944
+ *
945
+ * A `tool_removal` always references the tool by `toolName`.
935
946
  */
936
947
  toolChanges: z3.array(
937
- z3.discriminatedUnion("type", [
948
+ z3.union([
938
949
  z3.object({
939
950
  type: z3.literal("tool_addition"),
940
951
  toolName: z3.string()
941
952
  }),
953
+ z3.object({
954
+ type: z3.literal("tool_addition"),
955
+ tool: z3.union([
956
+ z3.looseObject({
957
+ type: z3.literal("function"),
958
+ name: z3.string(),
959
+ inputSchema: z3.record(z3.string(), z3.unknown())
960
+ }),
961
+ z3.looseObject({
962
+ type: z3.literal("provider"),
963
+ id: z3.string(),
964
+ name: z3.string(),
965
+ args: z3.record(z3.string(), z3.unknown())
966
+ })
967
+ ])
968
+ }),
942
969
  z3.object({
943
970
  type: z3.literal("tool_removal"),
944
971
  toolName: z3.string()
@@ -1666,6 +1693,7 @@ import { validateTypes } from "@ai-sdk/provider-utils";
1666
1693
  async function prepareTools({
1667
1694
  tools,
1668
1695
  toolChoice,
1696
+ hasInlineTools = false,
1669
1697
  disableParallelToolUse,
1670
1698
  cacheControlValidator,
1671
1699
  supportsStructuredOutput,
@@ -1678,11 +1706,11 @@ async function prepareTools({
1678
1706
  const toolWarnings = [];
1679
1707
  const betas = /* @__PURE__ */ new Set();
1680
1708
  const validator = cacheControlValidator || new CacheControlValidator();
1681
- if (tools == null) {
1709
+ if (tools == null && !hasInlineTools) {
1682
1710
  return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
1683
1711
  }
1684
1712
  const anthropicTools2 = [];
1685
- for (const tool of tools) {
1713
+ for (const tool of tools != null ? tools : []) {
1686
1714
  switch (tool.type) {
1687
1715
  case "function": {
1688
1716
  const cacheControl = validator.getCacheControl(tool.providerOptions, {
@@ -1994,9 +2022,10 @@ async function prepareTools({
1994
2022
  }
1995
2023
  }
1996
2024
  }
2025
+ const declaredTools = tools == null ? void 0 : anthropicTools2;
1997
2026
  if (toolChoice == null) {
1998
2027
  return {
1999
- tools: anthropicTools2,
2028
+ tools: declaredTools,
2000
2029
  toolChoice: disableParallelToolUse ? { type: "auto", disable_parallel_tool_use: disableParallelToolUse } : void 0,
2001
2030
  toolWarnings,
2002
2031
  betas
@@ -2006,7 +2035,7 @@ async function prepareTools({
2006
2035
  switch (type) {
2007
2036
  case "auto":
2008
2037
  return {
2009
- tools: anthropicTools2,
2038
+ tools: declaredTools,
2010
2039
  toolChoice: {
2011
2040
  type: "auto",
2012
2041
  disable_parallel_tool_use: disableParallelToolUse
@@ -2022,7 +2051,7 @@ async function prepareTools({
2022
2051
  details: `toolChoice 'required' is not supported with this model or thinking configuration. Using 'auto' instead. Instruct the model to use a tool in the prompt and verify that a tool call was made.`
2023
2052
  });
2024
2053
  return {
2025
- tools: anthropicTools2,
2054
+ tools: declaredTools,
2026
2055
  toolChoice: {
2027
2056
  type: "auto",
2028
2057
  disable_parallel_tool_use: disableParallelToolUse
@@ -2032,7 +2061,7 @@ async function prepareTools({
2032
2061
  };
2033
2062
  }
2034
2063
  return {
2035
- tools: anthropicTools2,
2064
+ tools: declaredTools,
2036
2065
  toolChoice: {
2037
2066
  type: "any",
2038
2067
  disable_parallel_tool_use: disableParallelToolUse
@@ -2042,7 +2071,7 @@ async function prepareTools({
2042
2071
  };
2043
2072
  case "none":
2044
2073
  return {
2045
- tools: anthropicTools2,
2074
+ tools: declaredTools,
2046
2075
  toolChoice: { type: "none" },
2047
2076
  toolWarnings,
2048
2077
  betas
@@ -2055,7 +2084,7 @@ async function prepareTools({
2055
2084
  details: `toolChoice 'tool' is not supported with this model or thinking configuration. Only the '${toolChoice.toolName}' tool is sent with 'auto' tool choice. Instruct the model to use the tool in the prompt and verify that a tool call was made.`
2056
2085
  });
2057
2086
  return {
2058
- tools: anthropicTools2.filter(
2087
+ tools: declaredTools == null ? void 0 : declaredTools.filter(
2059
2088
  (tool) => "name" in tool && tool.name === toolChoice.toolName
2060
2089
  ),
2061
2090
  toolChoice: {
@@ -2067,7 +2096,7 @@ async function prepareTools({
2067
2096
  };
2068
2097
  }
2069
2098
  return {
2070
- tools: anthropicTools2,
2099
+ tools: declaredTools,
2071
2100
  toolChoice: {
2072
2101
  type: "tool",
2073
2102
  name: toolChoice.toolName,
@@ -2142,6 +2171,7 @@ import {
2142
2171
  UnsupportedFunctionalityError as UnsupportedFunctionalityError2
2143
2172
  } from "@ai-sdk/provider";
2144
2173
  import {
2174
+ stringifyWithBigIntAndCycles,
2145
2175
  convertBase64ToUint8Array,
2146
2176
  convertToBase64,
2147
2177
  parseProviderOptions,
@@ -2513,6 +2543,32 @@ async function extractErrorValue(value) {
2513
2543
  }
2514
2544
  return {};
2515
2545
  }
2546
+ function isComputerTool(tool) {
2547
+ return tool.type === "provider" && tool.id.startsWith("anthropic.computer_");
2548
+ }
2549
+ async function getInlineToolsFromPrompt(prompt) {
2550
+ var _a;
2551
+ const inlineTools = [];
2552
+ for (const message of prompt) {
2553
+ if (message.role !== "system" || message.providerOptions == null) {
2554
+ continue;
2555
+ }
2556
+ const options = await parseProviderOptions({
2557
+ provider: "anthropic",
2558
+ providerOptions: message.providerOptions,
2559
+ schema: anthropicSystemMessageProviderOptions
2560
+ });
2561
+ for (const toolChange of (_a = options == null ? void 0 : options.toolChanges) != null ? _a : []) {
2562
+ if ("tool" in toolChange) {
2563
+ const tool = toolChange.tool;
2564
+ if (!isComputerTool(tool)) {
2565
+ inlineTools.push(tool);
2566
+ }
2567
+ }
2568
+ }
2569
+ }
2570
+ return inlineTools;
2571
+ }
2516
2572
  async function convertToAnthropicMessagesPrompt({
2517
2573
  prompt,
2518
2574
  sendReasoning,
@@ -2520,7 +2576,8 @@ async function convertToAnthropicMessagesPrompt({
2520
2576
  cacheControlValidator,
2521
2577
  toolNameMapping,
2522
2578
  toolsetNames = {},
2523
- convertMediaPart
2579
+ convertMediaPart,
2580
+ convertInlineTool
2524
2581
  }) {
2525
2582
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
2526
2583
  const betas = /* @__PURE__ */ new Set();
@@ -2557,6 +2614,7 @@ async function convertToAnthropicMessagesPrompt({
2557
2614
  case "system": {
2558
2615
  const systemMessages = [];
2559
2616
  let toolChangeCount = 0;
2617
+ let hasInlineToolDefinition = false;
2560
2618
  let hasMidConversationOptions = false;
2561
2619
  for (const { content: text, providerOptions } of block.messages) {
2562
2620
  const systemMessageOptions = await parseProviderOptions({
@@ -2579,6 +2637,40 @@ async function convertToAnthropicMessagesPrompt({
2579
2637
  });
2580
2638
  }
2581
2639
  for (const toolChange of toolChanges) {
2640
+ if ("tool" in toolChange) {
2641
+ if (convertInlineTool == null) {
2642
+ throw new UnsupportedFunctionalityError2({
2643
+ functionality: "tool additions by value in mid-conversation tool changes"
2644
+ });
2645
+ }
2646
+ const tool = toolChange.tool;
2647
+ if (isComputerTool(tool)) {
2648
+ warnings.push({
2649
+ type: "other",
2650
+ message: `The tool '${tool.name}' cannot be added by value in a tool change. Declare it in the tools option and add it by reference with toolName. The tool change has been ignored.`
2651
+ });
2652
+ continue;
2653
+ }
2654
+ const {
2655
+ definition,
2656
+ warnings: toolWarnings,
2657
+ betas: toolBetas
2658
+ } = await convertInlineTool(tool);
2659
+ warnings.push(...toolWarnings);
2660
+ for (const beta of toolBetas) {
2661
+ betas.add(beta);
2662
+ }
2663
+ if (definition == null) {
2664
+ continue;
2665
+ }
2666
+ content.push({
2667
+ type: "tool_addition",
2668
+ tool: { type: "tool_definition", definition }
2669
+ });
2670
+ toolChangeCount++;
2671
+ hasInlineToolDefinition = true;
2672
+ continue;
2673
+ }
2582
2674
  toolChangeCount++;
2583
2675
  content.push({
2584
2676
  type: toolChange.type,
@@ -2588,6 +2680,9 @@ async function convertToAnthropicMessagesPrompt({
2588
2680
  }
2589
2681
  });
2590
2682
  }
2683
+ if (content.length === 0 && clearAt == null && effort == null) {
2684
+ continue;
2685
+ }
2591
2686
  hasMidConversationOptions || (hasMidConversationOptions = clearAt != null || effort != null);
2592
2687
  systemMessages.push({
2593
2688
  role: "system",
@@ -2622,7 +2717,9 @@ async function convertToAnthropicMessagesPrompt({
2622
2717
  } else {
2623
2718
  messages.push(...systemMessages);
2624
2719
  betas.add("mid-conversation-system-2026-04-07");
2625
- if (toolChangeCount > 0) {
2720
+ if (hasInlineToolDefinition) {
2721
+ betas.add("inline-tools-2026-09-15");
2722
+ } else if (toolChangeCount > 0) {
2626
2723
  betas.add("mid-conversation-tool-changes-2026-07-01");
2627
2724
  }
2628
2725
  if (systemMessages.some((message) => message.clear_at != null)) {
@@ -2856,7 +2953,7 @@ async function convertToAnthropicMessagesPrompt({
2856
2953
  case "json":
2857
2954
  case "error-json":
2858
2955
  default:
2859
- contentValue = JSON.stringify(output.value);
2956
+ contentValue = stringifyWithBigIntAndCycles(output.value);
2860
2957
  break;
2861
2958
  }
2862
2959
  const toolsetName = getAnthropicToolsetName({
@@ -3094,7 +3191,7 @@ async function convertToAnthropicMessagesPrompt({
3094
3191
  type: "tool_use",
3095
3192
  id: part.toolCallId,
3096
3193
  name: part.toolName,
3097
- input: part.input,
3194
+ input: parseToolCallInput(part.input),
3098
3195
  ...caller && { caller },
3099
3196
  cache_control: cacheControl
3100
3197
  });
@@ -3579,6 +3676,18 @@ function getAnthropicCaller(providerOptions) {
3579
3676
  }
3580
3677
  return (caller == null ? void 0 : caller.type) === "direct" ? { type: "direct" } : void 0;
3581
3678
  }
3679
+ function parseToolCallInput(input) {
3680
+ if (typeof input === "string") {
3681
+ try {
3682
+ const parsed = secureJsonParse(input);
3683
+ if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
3684
+ return parsed;
3685
+ }
3686
+ } catch (e) {
3687
+ }
3688
+ }
3689
+ return input;
3690
+ }
3582
3691
 
3583
3692
  // src/map-anthropic-stop-reason.ts
3584
3693
  function mapAnthropicStopReason({
@@ -4171,9 +4280,10 @@ var AnthropicMessagesLanguageModel = class {
4171
4280
  }
4172
4281
  const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
4173
4282
  const supportsStructuredOutput = ((_b = this.config.supportsNativeStructuredOutput) != null ? _b : true) && modelSupportsStructuredOutput;
4283
+ const supportsResponseSchema = (responseFormat == null ? void 0 : responseFormat.type) !== "json" || responseFormat.schema == null || supportsNativeStructuredOutputSchema(responseFormat.schema);
4174
4284
  const supportsStrictTools = ((_c = this.config.supportsStrictTools) != null ? _c : true) && modelSupportsStructuredOutput;
4175
4285
  const structureOutputMode = (_d = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _d : "auto";
4176
- let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
4286
+ let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput && supportsResponseSchema;
4177
4287
  if (!useStructuredOutput && rejectsForcedToolUse && modelSupportsStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && supportsNativeStructuredOutputSchema(responseFormat.schema)) {
4178
4288
  warnings.push({
4179
4289
  type: "unsupported",
@@ -4199,8 +4309,22 @@ var AnthropicMessagesLanguageModel = class {
4199
4309
  const cacheControlValidator = new CacheControlValidator(
4200
4310
  this.config.cacheControlProviderOptionsName
4201
4311
  );
4312
+ const defaultEagerInputStreaming = stream && ((_e = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _e : true);
4313
+ const inlineTools = await getInlineToolsFromPrompt(prompt);
4314
+ const declaredFunctionToolNames = new Set(
4315
+ (tools != null ? tools : []).flatMap(
4316
+ (tool) => tool.type === "function" ? [tool.name] : []
4317
+ )
4318
+ );
4202
4319
  const toolNameMapping = createToolNameMapping({
4203
- tools,
4320
+ // later entries win when provider tool names collide, so the declared
4321
+ // tools go last and an inline tool cannot take over their mapping:
4322
+ tools: [
4323
+ ...inlineTools.filter(
4324
+ (tool) => !(tool.type === "provider" && declaredFunctionToolNames.has(tool.name))
4325
+ ),
4326
+ ...tools != null ? tools : []
4327
+ ],
4204
4328
  providerToolNames: {
4205
4329
  "anthropic.code_execution_20250522": "code_execution",
4206
4330
  "anthropic.code_execution_20250825": "code_execution",
@@ -4226,14 +4350,43 @@ var AnthropicMessagesLanguageModel = class {
4226
4350
  }
4227
4351
  });
4228
4352
  const toolsetNames = getAnthropicToolsetNames(tools);
4353
+ const inlineToolDefinitions = [];
4229
4354
  const { prompt: messagesPrompt, betas } = await convertToAnthropicMessagesPrompt({
4230
4355
  prompt,
4231
- sendReasoning: (_e = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _e : true,
4356
+ sendReasoning: (_f = anthropicOptions == null ? void 0 : anthropicOptions.sendReasoning) != null ? _f : true,
4232
4357
  warnings,
4233
4358
  cacheControlValidator,
4234
4359
  toolNameMapping,
4235
4360
  toolsetNames,
4236
- convertMediaPart: this.config.convertMediaPart
4361
+ convertMediaPart: this.config.convertMediaPart,
4362
+ convertInlineTool: async (tool) => {
4363
+ const {
4364
+ tools: definitions,
4365
+ toolWarnings: toolWarnings2,
4366
+ betas: betas2
4367
+ } = await prepareTools({
4368
+ tools: [tool],
4369
+ toolChoice: void 0,
4370
+ cacheControlValidator,
4371
+ supportsStructuredOutput,
4372
+ supportsStrictTools
4373
+ // no stream-dependent defaults (eager input streaming): the
4374
+ // definition is replayed on every request and has to stay
4375
+ // identical between streaming and non-streaming calls to keep
4376
+ // the cache.
4377
+ });
4378
+ if ((definitions == null ? void 0 : definitions[0]) != null) {
4379
+ inlineToolDefinitions.push({
4380
+ sdkName: tool.name,
4381
+ definition: definitions[0]
4382
+ });
4383
+ }
4384
+ return {
4385
+ definition: definitions == null ? void 0 : definitions[0],
4386
+ warnings: toolWarnings2,
4387
+ betas: betas2
4388
+ };
4389
+ }
4237
4390
  });
4238
4391
  if (rejectsThinkingDisabled && (anthropicOptions == null ? void 0 : anthropicOptions.thinking) != null) {
4239
4392
  const requestedThinking = anthropicOptions.thinking;
@@ -4343,7 +4496,7 @@ var AnthropicMessagesLanguageModel = class {
4343
4496
  ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
4344
4497
  cache_control: anthropicOptions.cacheControl
4345
4498
  },
4346
- ...((_f = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _f.userId) != null && {
4499
+ ...((_g = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _g.userId) != null && {
4347
4500
  metadata: { user_id: anthropicOptions.metadata.userId }
4348
4501
  },
4349
4502
  // mcp servers:
@@ -4538,7 +4691,6 @@ var AnthropicMessagesLanguageModel = class {
4538
4691
  } else if ((anthropicOptions == null ? void 0 : anthropicOptions.fallbacks) && anthropicOptions.fallbacks.length > 0) {
4539
4692
  betas.add("server-side-fallback-2026-06-01");
4540
4693
  }
4541
- const defaultEagerInputStreaming = stream && ((_g = anthropicOptions == null ? void 0 : anthropicOptions.toolStreaming) != null ? _g : true);
4542
4694
  const {
4543
4695
  tools: anthropicTools2,
4544
4696
  toolChoice: anthropicToolChoice,
@@ -4546,7 +4698,12 @@ var AnthropicMessagesLanguageModel = class {
4546
4698
  betas: toolsBetas
4547
4699
  } = await prepareTools(
4548
4700
  jsonResponseTool != null ? {
4549
- tools: [...tools != null ? tools : [], jsonResponseTool],
4701
+ tools: [
4702
+ ...(tools != null ? tools : []).filter(
4703
+ (tool) => (toolChoice == null ? void 0 : toolChoice.type) !== "none" && ((toolChoice == null ? void 0 : toolChoice.type) !== "tool" || tool.name === toolChoice.toolName)
4704
+ ),
4705
+ jsonResponseTool
4706
+ ],
4550
4707
  toolChoice: { type: "required" },
4551
4708
  disableParallelToolUse: true,
4552
4709
  cacheControlValidator,
@@ -4557,6 +4714,9 @@ var AnthropicMessagesLanguageModel = class {
4557
4714
  } : {
4558
4715
  tools: tools != null ? tools : [],
4559
4716
  toolChoice,
4717
+ // tool changes can add tools when `tools` is empty, so the tool
4718
+ // choice and parallel tool use settings still apply:
4719
+ hasInlineTools: inlineTools.length > 0,
4560
4720
  disableParallelToolUse: anthropicOptions == null ? void 0 : anthropicOptions.disableParallelToolUse,
4561
4721
  cacheControlValidator,
4562
4722
  supportsStructuredOutput,
@@ -4565,6 +4725,31 @@ var AnthropicMessagesLanguageModel = class {
4565
4725
  rejectsForcedToolUse: rejectsForcedToolUse || thinkingType === "enabled"
4566
4726
  }
4567
4727
  );
4728
+ if ((toolChoice == null ? void 0 : toolChoice.type) === "tool" && ((anthropicToolChoice == null ? void 0 : anthropicToolChoice.type) === "auto" || jsonResponseTool != null) || (toolChoice == null ? void 0 : toolChoice.type) === "none" && jsonResponseTool != null) {
4729
+ const emittedInlineDefinitions = new Set(
4730
+ messagesPrompt.messages.flatMap(
4731
+ (message) => message.role === "system" ? message.content.flatMap(
4732
+ (part) => part.type === "tool_addition" && part.tool.type === "tool_definition" ? [part.tool.definition] : []
4733
+ ) : []
4734
+ )
4735
+ );
4736
+ const selectedSdkName = toolChoice.type === "tool" ? toolChoice.toolName : void 0;
4737
+ const selectedTool = tools == null ? void 0 : tools.find((tool) => tool.name === selectedSdkName);
4738
+ const selectedProviderName = jsonResponseTool != null && selectedSdkName != null && (selectedTool == null ? void 0 : selectedTool.type) !== "function" ? toolNameMapping.toProviderToolName(selectedSdkName) : selectedSdkName;
4739
+ const conflictingTool = inlineToolDefinitions.find(
4740
+ ({ sdkName, definition }) => emittedInlineDefinitions.has(definition) && (toolChoice.type === "none" || // The JSON-tool path filters application tools by SDK name before
4741
+ // conversion; the forced-choice fallback filters by provider name.
4742
+ jsonResponseTool != null && sdkName !== selectedSdkName || !("name" in definition) || definition.name !== selectedProviderName)
4743
+ );
4744
+ if (conflictingTool != null) {
4745
+ const toolName = "name" in conflictingTool.definition ? conflictingTool.definition.name : conflictingTool.definition.type;
4746
+ const choice = toolChoice.type === "tool" ? `named tool choice '${toolChoice.toolName}'` : `tool choice 'none'`;
4747
+ throw new InvalidArgumentError({
4748
+ argument: "toolChoice",
4749
+ message: `Inline tool '${toolName}' conflicts with ${choice}. Inline definitions must respect the tool choice when forced tool use falls back or the JSON response tool is used.`
4750
+ });
4751
+ }
4752
+ }
4568
4753
  const cacheWarnings = cacheControlValidator.getWarnings();
4569
4754
  return {
4570
4755
  args: {
@@ -7017,7 +7202,7 @@ function createAnthropic(options = {}) {
7017
7202
  )) != null ? _a : ANTHROPIC_API_VERSIONED_URL;
7018
7203
  const providerName = (_b = options.name) != null ? _b : "anthropic.messages";
7019
7204
  if (options.apiKey && options.authToken) {
7020
- throw new InvalidArgumentError({
7205
+ throw new InvalidArgumentError2({
7021
7206
  argument: "apiKey/authToken",
7022
7207
  message: "Both apiKey and authToken were provided. Please use only one authentication method."
7023
7208
  });