@ai-sdk/anthropic 3.0.93 → 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 +9 -0
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +2 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +7 -5
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/anthropic-messages-language-model.ts +2 -1
- package/src/anthropic-provider.ts +13 -2
- package/src/convert-to-anthropic-messages-prompt.ts +3 -2
package/dist/internal/index.mjs
CHANGED
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
generateId,
|
|
11
11
|
parseProviderOptions as parseProviderOptions2,
|
|
12
12
|
postJsonToApi,
|
|
13
|
-
resolve
|
|
13
|
+
resolve,
|
|
14
|
+
secureJsonParse as secureJsonParse2
|
|
14
15
|
} from "@ai-sdk/provider-utils";
|
|
15
16
|
|
|
16
17
|
// src/anthropic-error.ts
|
|
@@ -1874,8 +1875,9 @@ import {
|
|
|
1874
1875
|
convertToBase64,
|
|
1875
1876
|
parseProviderOptions,
|
|
1876
1877
|
safeParseJSON,
|
|
1877
|
-
|
|
1878
|
-
|
|
1878
|
+
isNonNullable,
|
|
1879
|
+
secureJsonParse,
|
|
1880
|
+
validateTypes as validateTypes2
|
|
1879
1881
|
} from "@ai-sdk/provider-utils";
|
|
1880
1882
|
|
|
1881
1883
|
// src/tool/code-execution_20250522.ts
|
|
@@ -2740,7 +2742,7 @@ async function convertToAnthropicMessagesPrompt({
|
|
|
2740
2742
|
let errorInfo = {};
|
|
2741
2743
|
try {
|
|
2742
2744
|
if (typeof output.value === "string") {
|
|
2743
|
-
errorInfo =
|
|
2745
|
+
errorInfo = secureJsonParse(output.value);
|
|
2744
2746
|
} else if (typeof output.value === "object" && output.value !== null) {
|
|
2745
2747
|
errorInfo = output.value;
|
|
2746
2748
|
}
|
|
@@ -4848,7 +4850,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
4848
4850
|
let finalInput = contentBlock.input === "" ? "{}" : contentBlock.input;
|
|
4849
4851
|
if (contentBlock.providerToolName === "code_execution") {
|
|
4850
4852
|
try {
|
|
4851
|
-
const parsed =
|
|
4853
|
+
const parsed = secureJsonParse2(finalInput);
|
|
4852
4854
|
if (parsed != null && typeof parsed === "object" && "code" in parsed && !("type" in parsed)) {
|
|
4853
4855
|
finalInput = JSON.stringify({
|
|
4854
4856
|
type: "programmatic-tool-call",
|