@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/dist/index.mjs CHANGED
@@ -11,12 +11,11 @@ import {
11
11
  } from "@ai-sdk/provider-utils";
12
12
 
13
13
  // src/version.ts
14
- var VERSION = true ? "3.0.0-beta.77" : "0.0.0-test";
14
+ var VERSION = true ? "3.0.0-beta.78" : "0.0.0-test";
15
15
 
16
16
  // src/anthropic-messages-language-model.ts
17
17
  import {
18
- APICallError,
19
- UnsupportedFunctionalityError as UnsupportedFunctionalityError3
18
+ APICallError
20
19
  } from "@ai-sdk/provider";
21
20
  import {
22
21
  combineHeaders,
@@ -2259,7 +2258,7 @@ var AnthropicMessagesLanguageModel = class {
2259
2258
  toolNameMapping
2260
2259
  });
2261
2260
  const isThinking = ((_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.type) === "enabled";
2262
- const thinkingBudget = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.budgetTokens;
2261
+ let thinkingBudget = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.budgetTokens;
2263
2262
  const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
2264
2263
  const baseArgs = {
2265
2264
  // model id:
@@ -2351,9 +2350,16 @@ var AnthropicMessagesLanguageModel = class {
2351
2350
  };
2352
2351
  if (isThinking) {
2353
2352
  if (thinkingBudget == null) {
2354
- throw new UnsupportedFunctionalityError3({
2355
- functionality: "thinking requires a budget"
2353
+ warnings.push({
2354
+ type: "compatibility",
2355
+ feature: "extended thinking",
2356
+ details: "thinking budget is required when thinking is enabled. using default budget of 1024 tokens."
2356
2357
  });
2358
+ baseArgs.thinking = {
2359
+ type: "enabled",
2360
+ budget_tokens: 1024
2361
+ };
2362
+ thinkingBudget = 1024;
2357
2363
  }
2358
2364
  if (baseArgs.temperature != null) {
2359
2365
  baseArgs.temperature = void 0;
@@ -2379,7 +2385,7 @@ var AnthropicMessagesLanguageModel = class {
2379
2385
  details: "topP is not supported when thinking is enabled"
2380
2386
  });
2381
2387
  }
2382
- baseArgs.max_tokens = maxTokens + thinkingBudget;
2388
+ baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
2383
2389
  }
2384
2390
  if (isKnownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
2385
2391
  if (maxOutputTokens != null) {