@ai-sdk/google 4.0.20 → 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 CHANGED
@@ -1,5 +1,18 @@
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
+
10
+ ## 4.0.21
11
+
12
+ ### Patch Changes
13
+
14
+ - 7c16f21: feat(google): add `gemini-3.6-flash` and `gemini-3.5-flash-lite` models
15
+
3
16
  ## 4.0.20
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
11
11
  }>;
12
12
  type GoogleErrorData = InferSchema<typeof googleErrorDataSchema>;
13
13
 
14
- type GoogleModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'deep-research-max-preview-04-2026' | 'deep-research-preview-04-2026' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
14
+ type GoogleModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'deep-research-max-preview-04-2026' | 'deep-research-preview-04-2026' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
15
15
  declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
16
16
  responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
17
17
  thinkingConfig?: {
@@ -303,7 +303,7 @@ type GoogleFilesUploadOptions = {
303
303
  * the two surfaces (`:generateContent` vs `/interactions`) are independent and
304
304
  * may diverge over time.
305
305
  */
306
- type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
306
+ type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
307
307
  /**
308
308
  * Provider-options schema for `google.interactions(...)` calls. Read from the
309
309
  * shared `providerOptions.google.*` namespace (per PRD); per-call options that
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.20" : "0.0.0-test";
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 effectiveThoughtSignature = thoughtSignature != null ? thoughtSignature : isGemini3Model2 ? injectSkipSignature(part.toolName) : void 0;
753
- if (serverToolCallId && serverToolType) {
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({