@ai-sdk/google 4.0.21 → 4.0.22
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 +7 -0
- package/dist/index.js +36 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +14 -2
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +5 -0
- package/package.json +1 -1
- package/src/convert-to-google-messages.ts +18 -2
- package/src/realtime/google-realtime-event-mapper.ts +34 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 66b7151: fix(provider/google): preserve Gemini Live lifecycle events
|
|
8
|
+
- 5e5453c: Avoid missing thought-signature warnings and skip-validator injection for valid unsigned Gemini 3 parallel function calls in the same model response.
|
|
9
|
+
|
|
3
10
|
## 4.0.21
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "4.0.
|
|
10
|
+
var VERSION = true ? "4.0.22" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -657,6 +657,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
657
657
|
}
|
|
658
658
|
case "assistant": {
|
|
659
659
|
systemMessagesAllowed = false;
|
|
660
|
+
let modelResponseHasSignedFunctionCall = false;
|
|
660
661
|
contents.push({
|
|
661
662
|
role: "model",
|
|
662
663
|
parts: content.map((part) => {
|
|
@@ -749,8 +750,19 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
749
750
|
case "tool-call": {
|
|
750
751
|
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
751
752
|
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
752
|
-
const
|
|
753
|
-
|
|
753
|
+
const isServerToolCall = serverToolCallId != null && serverToolType != null;
|
|
754
|
+
const shouldSkipMissingSignatureMitigation = (
|
|
755
|
+
// Gemini 3 returns a single signature for a parallel
|
|
756
|
+
// function-call response on the first standard function
|
|
757
|
+
// call. Subsequent standard function calls in the same
|
|
758
|
+
// model response legitimately have no signature.
|
|
759
|
+
!isServerToolCall && thoughtSignature == null && modelResponseHasSignedFunctionCall
|
|
760
|
+
);
|
|
761
|
+
const effectiveThoughtSignature = thoughtSignature != null ? thoughtSignature : isGemini3Model2 && !shouldSkipMissingSignatureMitigation ? injectSkipSignature(part.toolName) : void 0;
|
|
762
|
+
if (!isServerToolCall && thoughtSignature != null) {
|
|
763
|
+
modelResponseHasSignedFunctionCall = true;
|
|
764
|
+
}
|
|
765
|
+
if (isServerToolCall) {
|
|
754
766
|
return {
|
|
755
767
|
toolCall: {
|
|
756
768
|
toolType: serverToolType,
|
|
@@ -6980,6 +6992,20 @@ var GoogleRealtimeEventMapper = class {
|
|
|
6980
6992
|
raw
|
|
6981
6993
|
};
|
|
6982
6994
|
}
|
|
6995
|
+
if (data.goAway != null) {
|
|
6996
|
+
return {
|
|
6997
|
+
type: "custom",
|
|
6998
|
+
rawType: "goAway",
|
|
6999
|
+
raw
|
|
7000
|
+
};
|
|
7001
|
+
}
|
|
7002
|
+
if (data.sessionResumptionUpdate != null) {
|
|
7003
|
+
return {
|
|
7004
|
+
type: "custom",
|
|
7005
|
+
rawType: "sessionResumptionUpdate",
|
|
7006
|
+
raw
|
|
7007
|
+
};
|
|
7008
|
+
}
|
|
6983
7009
|
if (data.serverContent != null) {
|
|
6984
7010
|
return this.parseServerContent(data.serverContent, raw);
|
|
6985
7011
|
}
|
|
@@ -7045,6 +7071,13 @@ var GoogleRealtimeEventMapper = class {
|
|
|
7045
7071
|
raw
|
|
7046
7072
|
});
|
|
7047
7073
|
}
|
|
7074
|
+
if (serverContent.generationComplete) {
|
|
7075
|
+
events.push({
|
|
7076
|
+
type: "custom",
|
|
7077
|
+
rawType: "generationComplete",
|
|
7078
|
+
raw
|
|
7079
|
+
});
|
|
7080
|
+
}
|
|
7048
7081
|
if (serverContent.turnComplete) {
|
|
7049
7082
|
if (this.hasAudio) {
|
|
7050
7083
|
events.push({
|