@ai-sdk/anthropic 2.0.88 → 2.0.90

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,18 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 2.0.90
4
+
5
+ ### Patch Changes
6
+
7
+ - db28434: 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
+ ## 2.0.89
10
+
11
+ ### Patch Changes
12
+
13
+ - 1b0e540: Use native structured output on supported Bedrock Anthropic models when thinking is enabled instead of forcing a JSON tool call.
14
+ - 5bb3ae4: Warn when an unknown model uses the default 4096 max output token limit.
15
+
3
16
  ## 2.0.88
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
31
31
  var import_provider_utils20 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/version.ts
34
- var VERSION = true ? "2.0.88" : "0.0.0-test";
34
+ var VERSION = true ? "2.0.90" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
@@ -2269,6 +2269,12 @@ var AnthropicMessagesLanguageModel = class {
2269
2269
  rejectsSamplingParameters,
2270
2270
  isKnownModel
2271
2271
  } = getModelCapabilities(this.modelId);
2272
+ if (!isKnownModel && maxOutputTokens == null) {
2273
+ warnings.push({
2274
+ type: "other",
2275
+ message: `The model "${this.modelId}" is unknown. The max output tokens have been limited to ${maxOutputTokensForModel}. Set maxOutputTokens explicitly to override this limit.`
2276
+ });
2277
+ }
2272
2278
  if (rejectsSamplingParameters) {
2273
2279
  if (temperature != null) {
2274
2280
  warnings.push({
@@ -2295,7 +2301,7 @@ var AnthropicMessagesLanguageModel = class {
2295
2301
  topP = void 0;
2296
2302
  }
2297
2303
  }
2298
- const isAnthropicModel = isKnownModel || this.modelId.startsWith("claude-");
2304
+ const isAnthropicModel = isKnownModel || this.modelId.includes("claude-");
2299
2305
  const structureOutputMode = (_a = anthropicOptions == null ? void 0 : anthropicOptions.structuredOutputMode) != null ? _a : "jsonTool";
2300
2306
  const useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
2301
2307
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useStructuredOutput ? {
@@ -3628,6 +3634,20 @@ function getModelCapabilities(modelId) {
3628
3634
  rejectsSamplingParameters: false,
3629
3635
  isKnownModel: true
3630
3636
  };
3637
+ } else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
3638
+ return {
3639
+ maxOutputTokens: 4096,
3640
+ supportsStructuredOutput: false,
3641
+ rejectsSamplingParameters: false,
3642
+ isKnownModel: false
3643
+ };
3644
+ } else if (modelId.includes("claude-")) {
3645
+ return {
3646
+ maxOutputTokens: 128e3,
3647
+ supportsStructuredOutput: true,
3648
+ rejectsSamplingParameters: true,
3649
+ isKnownModel: false
3650
+ };
3631
3651
  } else {
3632
3652
  return {
3633
3653
  maxOutputTokens: 4096,