@ai-sdk/google 3.0.98 → 3.0.99
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 +15 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +14 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/convert-to-google-generative-ai-messages.ts +18 -7
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "3.0.
|
|
10
|
+
var VERSION = true ? "3.0.99" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -599,6 +599,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
599
599
|
}
|
|
600
600
|
case "assistant": {
|
|
601
601
|
systemMessagesAllowed = false;
|
|
602
|
+
let modelResponseHasSignedFunctionCall = false;
|
|
602
603
|
contents.push({
|
|
603
604
|
role: "model",
|
|
604
605
|
parts: content.map((part) => {
|
|
@@ -639,8 +640,19 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
639
640
|
case "tool-call": {
|
|
640
641
|
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
641
642
|
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
642
|
-
const
|
|
643
|
-
|
|
643
|
+
const isServerToolCall = serverToolCallId != null && serverToolType != null;
|
|
644
|
+
const shouldSkipMissingSignatureMitigation = (
|
|
645
|
+
// Gemini 3 returns a single signature for a parallel
|
|
646
|
+
// function-call response on the first standard function
|
|
647
|
+
// call. Subsequent standard function calls in the same
|
|
648
|
+
// model response legitimately have no signature.
|
|
649
|
+
!isServerToolCall && thoughtSignature == null && modelResponseHasSignedFunctionCall
|
|
650
|
+
);
|
|
651
|
+
const effectiveThoughtSignature = thoughtSignature != null ? thoughtSignature : isGemini3Model && !shouldSkipMissingSignatureMitigation ? injectSkipSignature(part.toolName) : void 0;
|
|
652
|
+
if (!isServerToolCall && thoughtSignature != null) {
|
|
653
|
+
modelResponseHasSignedFunctionCall = true;
|
|
654
|
+
}
|
|
655
|
+
if (isServerToolCall) {
|
|
644
656
|
return {
|
|
645
657
|
toolCall: {
|
|
646
658
|
toolType: serverToolType,
|