@ai-sdk/anthropic 3.0.0-beta.77 → 3.0.0-beta.78

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,11 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 3.0.0-beta.78
4
+
5
+ ### Patch Changes
6
+
7
+ - 9e1e758: fix(anthropic): use default thinking budget when unspecified
8
+
3
9
  ## 3.0.0-beta.77
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
31
31
  var import_provider_utils22 = require("@ai-sdk/provider-utils");
32
32
 
33
33
  // src/version.ts
34
- var VERSION = true ? "3.0.0-beta.77" : "0.0.0-test";
34
+ var VERSION = true ? "3.0.0-beta.78" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
@@ -2234,7 +2234,7 @@ var AnthropicMessagesLanguageModel = class {
2234
2234
  toolNameMapping
2235
2235
  });
2236
2236
  const isThinking = ((_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.type) === "enabled";
2237
- const thinkingBudget = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.budgetTokens;
2237
+ let thinkingBudget = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.budgetTokens;
2238
2238
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
2239
2239
  const baseArgs = {
2240
2240
  // model id:
@@ -2326,9 +2326,16 @@ var AnthropicMessagesLanguageModel = class {
2326
2326
  };
2327
2327
  if (isThinking) {
2328
2328
  if (thinkingBudget == null) {
2329
- throw new import_provider3.UnsupportedFunctionalityError({
2330
- functionality: "thinking requires a budget"
2329
+ warnings.push({
2330
+ type: "compatibility",
2331
+ feature: "extended thinking",
2332
+ details: "thinking budget is required when thinking is enabled. using default budget of 1024 tokens."
2331
2333
  });
2334
+ baseArgs.thinking = {
2335
+ type: "enabled",
2336
+ budget_tokens: 1024
2337
+ };
2338
+ thinkingBudget = 1024;
2332
2339
  }
2333
2340
  if (baseArgs.temperature != null) {
2334
2341
  baseArgs.temperature = void 0;
@@ -2354,7 +2361,7 @@ var AnthropicMessagesLanguageModel = class {
2354
2361
  details: "topP is not supported when thinking is enabled"
2355
2362
  });
2356
2363
  }
2357
- baseArgs.max_tokens = maxTokens + thinkingBudget;
2364
+ baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
2358
2365
  }
2359
2366
  if (isKnownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
2360
2367
  if (maxOutputTokens != null) {