@ai-sdk/anthropic 4.0.17 → 4.0.19

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 4.0.19
4
+
5
+ ### Patch Changes
6
+
7
+ - 01a596a: fix (provider/anthropic): use current-generation capability defaults for unrecognized Claude model IDs while retaining conservative defaults for legacy Claude and non-Claude models.
8
+
9
+ ## 4.0.18
10
+
11
+ ### Patch Changes
12
+
13
+ - 97de198: Warn when an unknown model uses the default 4096 max output token limit.
14
+
3
15
  ## 4.0.17
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3628,6 +3628,13 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
3628
3628
  supportsXhighEffort,
3629
3629
  isKnownModel
3630
3630
  } = getModelCapabilities(this.modelId);
3631
+ if (!isKnownModel && maxOutputTokens == null) {
3632
+ warnings.push({
3633
+ type: "compatibility",
3634
+ feature: "maxOutputTokens",
3635
+ details: `The model "${this.modelId}" is unknown. The max output tokens have been limited to ${maxOutputTokensForModel}. Set maxOutputTokens explicitly to override this limit.`
3636
+ });
3637
+ }
3631
3638
  if (rejectsSamplingParameters) {
3632
3639
  if (temperature != null) {
3633
3640
  warnings.push({
@@ -3654,7 +3661,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
3654
3661
  topP = void 0;
3655
3662
  }
3656
3663
  }
3657
- const isAnthropicModel = isKnownModel || this.modelId.startsWith("claude-");
3664
+ const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
3658
3665
  const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
3659
3666
  const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
3660
3667
  const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
@@ -5500,6 +5507,24 @@ function getModelCapabilities(modelId) {
5500
5507
  supportsXhighEffort: false,
5501
5508
  isKnownModel: true
5502
5509
  };
5510
+ } else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
5511
+ return {
5512
+ maxOutputTokens: 4096,
5513
+ supportsStructuredOutput: false,
5514
+ supportsAdaptiveThinking: false,
5515
+ rejectsSamplingParameters: false,
5516
+ supportsXhighEffort: false,
5517
+ isKnownModel: false
5518
+ };
5519
+ } else if (modelId.includes("claude-")) {
5520
+ return {
5521
+ maxOutputTokens: 128e3,
5522
+ supportsStructuredOutput: true,
5523
+ supportsAdaptiveThinking: true,
5524
+ rejectsSamplingParameters: true,
5525
+ supportsXhighEffort: true,
5526
+ isKnownModel: false
5527
+ };
5503
5528
  } else {
5504
5529
  return {
5505
5530
  maxOutputTokens: 4096,
@@ -6340,7 +6365,7 @@ var AnthropicSkills = class {
6340
6365
  };
6341
6366
 
6342
6367
  // src/version.ts
6343
- var VERSION = true ? "4.0.17" : "0.0.0-test";
6368
+ var VERSION = true ? "4.0.19" : "0.0.0-test";
6344
6369
 
6345
6370
  // src/anthropic-provider.ts
6346
6371
  var ANTHROPIC_API_URL = "https://api.anthropic.com";