@ai-sdk/google 4.0.6 → 4.0.7
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 +8 -6
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +6 -4
- package/dist/internal/index.js.map +1 -1
- package/package.json +2 -2
- package/src/convert-to-google-messages.ts +2 -1
- package/src/google-embedding-model.ts +1 -1
- package/src/interactions/convert-to-google-interactions-input.ts +2 -1
package/dist/internal/index.js
CHANGED
|
@@ -182,7 +182,8 @@ import {
|
|
|
182
182
|
getTopLevelMediaType,
|
|
183
183
|
isFullMediaType,
|
|
184
184
|
resolveFullMediaType,
|
|
185
|
-
resolveProviderReference
|
|
185
|
+
resolveProviderReference,
|
|
186
|
+
secureJsonParse
|
|
186
187
|
} from "@ai-sdk/provider-utils";
|
|
187
188
|
var SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator";
|
|
188
189
|
var dataUrlRegex = /^data:([^;,]+);base64,(.+)$/s;
|
|
@@ -500,7 +501,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
500
501
|
return {
|
|
501
502
|
toolCall: {
|
|
502
503
|
toolType: serverToolType,
|
|
503
|
-
args: typeof part.input === "string" ?
|
|
504
|
+
args: typeof part.input === "string" ? secureJsonParse(part.input) : part.input,
|
|
504
505
|
id: serverToolCallId
|
|
505
506
|
},
|
|
506
507
|
thoughtSignature: effectiveThoughtSignature
|
|
@@ -3660,7 +3661,8 @@ import {
|
|
|
3660
3661
|
getTopLevelMediaType as getTopLevelMediaType2,
|
|
3661
3662
|
isFullMediaType as isFullMediaType2,
|
|
3662
3663
|
resolveFullMediaType as resolveFullMediaType2,
|
|
3663
|
-
resolveProviderReference as resolveProviderReference2
|
|
3664
|
+
resolveProviderReference as resolveProviderReference2,
|
|
3665
|
+
secureJsonParse as secureJsonParse2
|
|
3664
3666
|
} from "@ai-sdk/provider-utils";
|
|
3665
3667
|
function convertToGoogleInteractionsInput({
|
|
3666
3668
|
prompt,
|
|
@@ -3905,7 +3907,7 @@ function compactPromptForPreviousInteraction({
|
|
|
3905
3907
|
}
|
|
3906
3908
|
function safeParseToolArgs(input) {
|
|
3907
3909
|
try {
|
|
3908
|
-
const parsed =
|
|
3910
|
+
const parsed = secureJsonParse2(input);
|
|
3909
3911
|
if (parsed != null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
3910
3912
|
return parsed;
|
|
3911
3913
|
}
|