@ai-sdk/anthropic 3.0.92 → 3.0.94
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 +17 -0
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -9
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +4 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +9 -6
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/anthropic-messages-language-model.ts +7 -2
- package/src/anthropic-provider.ts +13 -2
- package/src/convert-to-anthropic-messages-prompt.ts +3 -2
package/dist/internal/index.js
CHANGED
|
@@ -2699,7 +2699,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2699
2699
|
let errorInfo = {};
|
|
2700
2700
|
try {
|
|
2701
2701
|
if (typeof output.value === "string") {
|
|
2702
|
-
errorInfo =
|
|
2702
|
+
errorInfo = (0, import_provider_utils14.secureJsonParse)(output.value);
|
|
2703
2703
|
} else if (typeof output.value === "object" && output.value !== null) {
|
|
2704
2704
|
errorInfo = output.value;
|
|
2705
2705
|
}
|
|
@@ -3457,6 +3457,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3457
3457
|
});
|
|
3458
3458
|
const thinkingType = (_e = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _e.type;
|
|
3459
3459
|
const isThinking = thinkingType === "enabled" || thinkingType === "adaptive";
|
|
3460
|
+
const sendThinking = isThinking || thinkingType === "disabled";
|
|
3460
3461
|
let thinkingBudget = thinkingType === "enabled" ? (_f = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _f.budgetTokens : void 0;
|
|
3461
3462
|
const thinkingDisplay = thinkingType === "adaptive" ? (_g = anthropicOptions == null ? void 0 : anthropicOptions.thinking) == null ? void 0 : _g.display : void 0;
|
|
3462
3463
|
const maxTokens = maxOutputTokens != null ? maxOutputTokens : maxOutputTokensForModel;
|
|
@@ -3470,7 +3471,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3470
3471
|
top_p: topP,
|
|
3471
3472
|
stop_sequences: stopSequences,
|
|
3472
3473
|
// provider specific settings:
|
|
3473
|
-
...
|
|
3474
|
+
...sendThinking && {
|
|
3474
3475
|
thinking: {
|
|
3475
3476
|
type: thinkingType,
|
|
3476
3477
|
...thinkingBudget != null && { budget_tokens: thinkingBudget },
|
|
@@ -4806,7 +4807,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4806
4807
|
let finalInput = contentBlock.input === "" ? "{}" : contentBlock.input;
|
|
4807
4808
|
if (contentBlock.providerToolName === "code_execution") {
|
|
4808
4809
|
try {
|
|
4809
|
-
const parsed =
|
|
4810
|
+
const parsed = (0, import_provider_utils15.secureJsonParse)(finalInput);
|
|
4810
4811
|
if (parsed != null && typeof parsed === "object" && "code" in parsed && !("type" in parsed)) {
|
|
4811
4812
|
finalInput = JSON.stringify({
|
|
4812
4813
|
type: "programmatic-tool-call",
|