@ai-sdk/anthropic 3.0.99 → 3.0.101

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
+ ## 3.0.101
4
+
5
+ ### Patch Changes
6
+
7
+ - 0608dca: 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
+ ## 3.0.100
10
+
11
+ ### Patch Changes
12
+
13
+ - b7afc80: Warn when an unknown model uses the default 4096 max output token limit.
14
+
3
15
  ## 3.0.99
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
32
32
  var import_provider_utils26 = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "3.0.99" : "0.0.0-test";
35
+ var VERSION = true ? "3.0.101" : "0.0.0-test";
36
36
 
37
37
  // src/anthropic-messages-language-model.ts
38
38
  var import_provider3 = require("@ai-sdk/provider");
@@ -3396,6 +3396,13 @@ var AnthropicMessagesLanguageModel = class {
3396
3396
  rejectsSamplingParameters,
3397
3397
  isKnownModel
3398
3398
  } = getModelCapabilities(this.modelId);
3399
+ if (!isKnownModel && maxOutputTokens == null) {
3400
+ warnings.push({
3401
+ type: "compatibility",
3402
+ feature: "maxOutputTokens",
3403
+ details: `The model "${this.modelId}" is unknown. The max output tokens have been limited to ${maxOutputTokensForModel}. Set maxOutputTokens explicitly to override this limit.`
3404
+ });
3405
+ }
3399
3406
  if (rejectsSamplingParameters) {
3400
3407
  if (temperature != null) {
3401
3408
  warnings.push({
@@ -3422,7 +3429,7 @@ var AnthropicMessagesLanguageModel = class {
3422
3429
  topP = void 0;
3423
3430
  }
3424
3431
  }
3425
- const isAnthropicModel = isKnownModel || this.modelId.startsWith("claude-");
3432
+ const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
3426
3433
  const supportsStructuredOutput = ((_a = this.config.supportsNativeStructuredOutput) != null ? _a : true) && modelSupportsStructuredOutput;
3427
3434
  const supportsStrictTools = ((_b = this.config.supportsStrictTools) != null ? _b : true) && modelSupportsStructuredOutput;
3428
3435
  const structureOutputMode = (_c = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _c : "auto";
@@ -5240,6 +5247,20 @@ function getModelCapabilities(modelId) {
5240
5247
  rejectsSamplingParameters: false,
5241
5248
  isKnownModel: true
5242
5249
  };
5250
+ } else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
5251
+ return {
5252
+ maxOutputTokens: 4096,
5253
+ supportsStructuredOutput: false,
5254
+ rejectsSamplingParameters: false,
5255
+ isKnownModel: false
5256
+ };
5257
+ } else if (modelId.includes("claude-")) {
5258
+ return {
5259
+ maxOutputTokens: 128e3,
5260
+ supportsStructuredOutput: true,
5261
+ rejectsSamplingParameters: true,
5262
+ isKnownModel: false
5263
+ };
5243
5264
  } else {
5244
5265
  return {
5245
5266
  maxOutputTokens: 4096,