@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 +6 -0
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +11 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +12 -6
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// src/anthropic-messages-language-model.ts
|
|
2
2
|
import {
|
|
3
|
-
APICallError
|
|
4
|
-
UnsupportedFunctionalityError as UnsupportedFunctionalityError3
|
|
3
|
+
APICallError
|
|
5
4
|
} from "@ai-sdk/provider";
|
|
6
5
|
import {
|
|
7
6
|
combineHeaders,
|
|
@@ -2244,7 +2243,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2244
2243
|
toolNameMapping
|
|
2245
2244
|
});
|
|
2246
2245
|
const isThinking = ((_c = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _c.type) === "enabled";
|
|
2247
|
-
|
|
2246
|
+
let thinkingBudget = (_d = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _d.budgetTokens;
|
|
2248
2247
|
const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
|
|
2249
2248
|
const baseArgs = {
|
|
2250
2249
|
// model id:
|
|
@@ -2336,9 +2335,16 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2336
2335
|
};
|
|
2337
2336
|
if (isThinking) {
|
|
2338
2337
|
if (thinkingBudget == null) {
|
|
2339
|
-
|
|
2340
|
-
|
|
2338
|
+
warnings.push({
|
|
2339
|
+
type: "compatibility",
|
|
2340
|
+
feature: "extended thinking",
|
|
2341
|
+
details: "thinking budget is required when thinking is enabled. using default budget of 1024 tokens."
|
|
2341
2342
|
});
|
|
2343
|
+
baseArgs.thinking = {
|
|
2344
|
+
type: "enabled",
|
|
2345
|
+
budget_tokens: 1024
|
|
2346
|
+
};
|
|
2347
|
+
thinkingBudget = 1024;
|
|
2342
2348
|
}
|
|
2343
2349
|
if (baseArgs.temperature != null) {
|
|
2344
2350
|
baseArgs.temperature = void 0;
|
|
@@ -2364,7 +2370,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2364
2370
|
details: "topP is not supported when thinking is enabled"
|
|
2365
2371
|
});
|
|
2366
2372
|
}
|
|
2367
|
-
baseArgs.max_tokens = maxTokens + thinkingBudget;
|
|
2373
|
+
baseArgs.max_tokens = maxTokens + (thinkingBudget != null ? thinkingBudget : 0);
|
|
2368
2374
|
}
|
|
2369
2375
|
if (isKnownModel && baseArgs.max_tokens > maxOutputTokensForModel) {
|
|
2370
2376
|
if (maxOutputTokens != null) {
|