@ai-sdk/google 4.0.0-beta.7 → 4.0.0-beta.82

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +614 -5
  2. package/README.md +6 -4
  3. package/dist/index.d.ts +301 -50
  4. package/dist/index.js +5410 -639
  5. package/dist/index.js.map +1 -1
  6. package/dist/internal/index.d.ts +100 -26
  7. package/dist/internal/index.js +1653 -451
  8. package/dist/internal/index.js.map +1 -1
  9. package/docs/{15-google-generative-ai.mdx → 15-google.mdx} +784 -69
  10. package/package.json +16 -17
  11. package/src/{convert-google-generative-ai-usage.ts → convert-google-usage.ts} +13 -5
  12. package/src/convert-json-schema-to-openapi-schema.ts +1 -1
  13. package/src/convert-to-google-messages.ts +647 -0
  14. package/src/{google-generative-ai-embedding-options.ts → google-embedding-model-options.ts} +9 -2
  15. package/src/{google-generative-ai-embedding-model.ts → google-embedding-model.ts} +31 -18
  16. package/src/google-error.ts +1 -1
  17. package/src/google-files.ts +225 -0
  18. package/src/google-image-model-options.ts +35 -0
  19. package/src/{google-generative-ai-image-model.ts → google-image-model.ts} +116 -65
  20. package/src/{google-generative-ai-image-settings.ts → google-image-settings.ts} +2 -2
  21. package/src/google-json-accumulator.ts +371 -0
  22. package/src/{google-generative-ai-options.ts → google-language-model-options.ts} +50 -5
  23. package/src/{google-generative-ai-language-model.ts → google-language-model.ts} +701 -219
  24. package/src/google-prepare-tools.ts +72 -12
  25. package/src/google-prompt.ts +86 -0
  26. package/src/google-provider.ts +157 -53
  27. package/src/google-speech-api.ts +36 -0
  28. package/src/google-speech-model-options.ts +48 -0
  29. package/src/google-speech-model.ts +311 -0
  30. package/src/google-video-model-options.ts +43 -0
  31. package/src/{google-generative-ai-video-model.ts → google-video-model.ts} +25 -60
  32. package/src/{google-generative-ai-video-settings.ts → google-video-settings.ts} +2 -1
  33. package/src/index.ts +40 -9
  34. package/src/interactions/build-google-interactions-stream-transform.ts +818 -0
  35. package/src/interactions/cancel-google-interaction.ts +60 -0
  36. package/src/interactions/convert-google-interactions-usage.ts +47 -0
  37. package/src/interactions/convert-to-google-interactions-input.ts +557 -0
  38. package/src/interactions/extract-google-interactions-sources.ts +252 -0
  39. package/src/interactions/google-interactions-agent.ts +15 -0
  40. package/src/interactions/google-interactions-api.ts +530 -0
  41. package/src/interactions/google-interactions-language-model-options.ts +262 -0
  42. package/src/interactions/google-interactions-language-model.ts +776 -0
  43. package/src/interactions/google-interactions-prompt.ts +582 -0
  44. package/src/interactions/google-interactions-provider-metadata.ts +23 -0
  45. package/src/interactions/map-google-interactions-finish-reason.ts +31 -0
  46. package/src/interactions/parse-google-interactions-outputs.ts +252 -0
  47. package/src/interactions/poll-google-interactions.ts +129 -0
  48. package/src/interactions/prepare-google-interactions-tools.ts +245 -0
  49. package/src/interactions/stream-google-interactions.ts +242 -0
  50. package/src/interactions/synthesize-google-interactions-agent-stream.ts +185 -0
  51. package/src/internal/index.ts +3 -2
  52. package/src/{map-google-generative-ai-finish-reason.ts → map-google-finish-reason.ts} +3 -3
  53. package/src/realtime/google-realtime-event-mapper.ts +383 -0
  54. package/src/realtime/google-realtime-model-options.ts +3 -0
  55. package/src/realtime/google-realtime-model.ts +160 -0
  56. package/src/realtime/index.ts +2 -0
  57. package/src/tool/code-execution.ts +2 -2
  58. package/src/tool/enterprise-web-search.ts +9 -3
  59. package/src/tool/file-search.ts +5 -7
  60. package/src/tool/google-maps.ts +3 -2
  61. package/src/tool/google-search.ts +11 -12
  62. package/src/tool/url-context.ts +4 -2
  63. package/src/tool/vertex-rag-store.ts +9 -6
  64. package/dist/index.d.mts +0 -376
  65. package/dist/index.mjs +0 -2517
  66. package/dist/index.mjs.map +0 -1
  67. package/dist/internal/index.d.mts +0 -284
  68. package/dist/internal/index.mjs +0 -1706
  69. package/dist/internal/index.mjs.map +0 -1
  70. package/src/convert-to-google-generative-ai-messages.ts +0 -239
  71. package/src/google-generative-ai-prompt.ts +0 -38
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
2
  import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
3
- import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3, Experimental_VideoModelV3 } from '@ai-sdk/provider';
3
+ import { ProviderV4, LanguageModelV4, ImageModelV4, EmbeddingModelV4, Experimental_VideoModelV4, SpeechModelV4, FilesV4, Experimental_RealtimeFactoryV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig } from '@ai-sdk/provider';
4
4
 
5
5
  declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
6
6
  error: {
@@ -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 GoogleGenerativeAIModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-exp-image-generation' | '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-lite-preview-09-2025' | '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-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | '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-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?: {
@@ -39,6 +39,10 @@ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
39
39
  longitude: number;
40
40
  } | undefined;
41
41
  } | undefined;
42
+ streamFunctionCallArguments?: boolean | undefined;
43
+ serviceTier?: "standard" | "flex" | "priority" | undefined;
44
+ sharedRequestType?: "standard" | "flex" | "priority" | undefined;
45
+ requestType?: "shared" | undefined;
42
46
  }>;
43
47
  type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
44
48
 
@@ -47,8 +51,18 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
47
51
  content?: Record<string, never> | {
48
52
  parts?: ({
49
53
  functionCall: {
50
- name: string;
51
- args: unknown;
54
+ id?: string | null | undefined;
55
+ name?: string | null | undefined;
56
+ args?: unknown;
57
+ partialArgs?: {
58
+ jsonPath: string;
59
+ stringValue?: string | null | undefined;
60
+ numberValue?: number | null | undefined;
61
+ boolValue?: boolean | null | undefined;
62
+ nullValue?: unknown;
63
+ willContinue?: boolean | null | undefined;
64
+ }[] | null | undefined;
65
+ willContinue?: boolean | null | undefined;
52
66
  };
53
67
  thoughtSignature?: string | null | undefined;
54
68
  } | {
@@ -58,6 +72,20 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
58
72
  };
59
73
  thought?: boolean | null | undefined;
60
74
  thoughtSignature?: string | null | undefined;
75
+ } | {
76
+ toolCall: {
77
+ toolType: string;
78
+ id: string;
79
+ args?: unknown;
80
+ };
81
+ thoughtSignature?: string | null | undefined;
82
+ } | {
83
+ toolResponse: {
84
+ toolType: string;
85
+ id: string;
86
+ response?: unknown;
87
+ };
88
+ thoughtSignature?: string | null | undefined;
61
89
  } | {
62
90
  executableCode?: {
63
91
  language: string;
@@ -73,6 +101,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
73
101
  })[] | null | undefined;
74
102
  } | null | undefined;
75
103
  finishReason?: string | null | undefined;
104
+ finishMessage?: string | null | undefined;
76
105
  safetyRatings?: {
77
106
  category?: string | null | undefined;
78
107
  probability?: string | null | undefined;
@@ -142,6 +171,15 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
142
171
  candidatesTokenCount?: number | null | undefined;
143
172
  totalTokenCount?: number | null | undefined;
144
173
  trafficType?: string | null | undefined;
174
+ serviceTier?: string | null | undefined;
175
+ promptTokensDetails?: {
176
+ modality: string;
177
+ tokenCount: number;
178
+ }[] | null | undefined;
179
+ candidatesTokensDetails?: {
180
+ modality: string;
181
+ tokenCount: number;
182
+ }[] | null | undefined;
145
183
  } | null | undefined;
146
184
  promptFeedback?: {
147
185
  blockReason?: string | null | undefined;
@@ -158,31 +196,42 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
158
196
  type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
159
197
  type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
160
198
  type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
199
+ type PromptFeedbackSchema = NonNullable<InferSchema<typeof responseSchema>['promptFeedback']>;
200
+ type UsageMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['usageMetadata']>;
161
201
 
162
- type GoogleGenerativeAIGroundingMetadata = GroundingMetadataSchema;
163
- type GoogleGenerativeAIUrlContextMetadata = UrlContextMetadataSchema;
164
- type GoogleGenerativeAISafetyRating = SafetyRatingSchema;
165
- interface GoogleGenerativeAIProviderMetadata {
166
- groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
167
- urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
168
- safetyRatings: GoogleGenerativeAISafetyRating[] | null;
169
- }
170
-
171
- type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | 'gemini-3.1-flash-image-preview' | (string & {});
172
- interface GoogleGenerativeAIImageSettings {
173
- /**
174
- * Override the maximum number of images per call (default 4)
175
- */
176
- maxImagesPerCall?: number;
202
+ type GoogleGroundingMetadata = GroundingMetadataSchema;
203
+ type GoogleUrlContextMetadata = UrlContextMetadataSchema;
204
+ type GoogleSafetyRating = SafetyRatingSchema;
205
+ type GooglePromptFeedback = PromptFeedbackSchema;
206
+ type GoogleUsageMetadata = UsageMetadataSchema;
207
+ interface GoogleProviderMetadata {
208
+ promptFeedback: GooglePromptFeedback | null;
209
+ groundingMetadata: GoogleGroundingMetadata | null;
210
+ urlContextMetadata: GoogleUrlContextMetadata | null;
211
+ safetyRatings: GoogleSafetyRating[] | null;
212
+ usageMetadata: GoogleUsageMetadata | null;
213
+ finishMessage: string | null;
214
+ serviceTier: string | null;
177
215
  }
178
216
 
179
217
  declare const googleImageModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
180
218
  personGeneration?: "dont_allow" | "allow_adult" | "allow_all" | null | undefined;
181
219
  aspectRatio?: "1:1" | "3:4" | "4:3" | "9:16" | "16:9" | null | undefined;
220
+ googleSearch?: {
221
+ [x: string]: unknown;
222
+ searchTypes?: {
223
+ webSearch?: Record<string, never> | undefined;
224
+ imageSearch?: Record<string, never> | undefined;
225
+ } | undefined;
226
+ timeRangeFilter?: {
227
+ startTime: string;
228
+ endTime: string;
229
+ } | undefined;
230
+ } | undefined;
182
231
  }>;
183
232
  type GoogleImageModelOptions = InferSchema<typeof googleImageModelOptionsSchema>;
184
233
 
185
- type GoogleGenerativeAIEmbeddingModelId = 'gemini-embedding-001' | 'gemini-embedding-2-preview' | (string & {});
234
+ type GoogleEmbeddingModelId = 'gemini-embedding-001' | 'gemini-embedding-2' | 'gemini-embedding-2-preview' | (string & {});
186
235
  declare const googleEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
187
236
  outputDimensionality?: number | undefined;
188
237
  taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined;
@@ -193,12 +242,15 @@ declare const googleEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
193
242
  mimeType: string;
194
243
  data: string;
195
244
  };
245
+ } | {
246
+ fileData: {
247
+ fileUri: string;
248
+ mimeType: string;
249
+ };
196
250
  })[] | null)[] | undefined;
197
251
  }>;
198
252
  type GoogleEmbeddingModelOptions = InferSchema<typeof googleEmbeddingModelOptions>;
199
253
 
200
- type GoogleGenerativeAIVideoModelId = 'veo-3.1-fast-generate-preview' | 'veo-3.1-generate-preview' | 'veo-3.1-generate' | 'veo-3.0-generate-001' | 'veo-3.0-fast-generate-001' | 'veo-2.0-generate-001' | (string & {});
201
-
202
254
  type GoogleVideoModelOptions = {
203
255
  pollIntervalMs?: number | null;
204
256
  pollTimeoutMs?: number | null;
@@ -211,12 +263,154 @@ type GoogleVideoModelOptions = {
211
263
  [key: string]: unknown;
212
264
  };
213
265
 
266
+ type GoogleVideoModelId = 'veo-3.1-fast-generate-preview' | 'veo-3.1-generate-preview' | 'veo-3.1-generate' | 'veo-3.1-lite-generate-preview' | 'veo-3.0-generate-001' | 'veo-3.0-fast-generate-001' | 'veo-2.0-generate-001' | (string & {});
267
+
268
+ type GoogleSpeechModelId = 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-3.1-flash-tts-preview' | (string & {});
269
+ declare const googleSpeechProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
270
+ multiSpeakerVoiceConfig?: {
271
+ speakerVoiceConfigs: {
272
+ speaker: string;
273
+ voiceConfig: {
274
+ prebuiltVoiceConfig: {
275
+ voiceName: string;
276
+ };
277
+ };
278
+ }[];
279
+ } | undefined;
280
+ }>;
281
+ type GoogleSpeechModelOptions = InferSchema<typeof googleSpeechProviderOptionsSchema>;
282
+
283
+ type GoogleFilesUploadOptions = {
284
+ displayName?: string | null;
285
+ pollIntervalMs?: number | null;
286
+ pollTimeoutMs?: number | null;
287
+ [key: string]: unknown;
288
+ };
289
+
290
+ /**
291
+ * Type-only union of Gemini model IDs that the Interactions API accepts via
292
+ * `model:`. Mirrors `Model` from `googleapis/js-genai`
293
+ * `src/interactions/resources/interactions.ts`.
294
+ *
295
+ * Kept as a separate type from `GoogleModelId` even though most IDs overlap;
296
+ * the two surfaces (`:generateContent` vs `/interactions`) are independent and
297
+ * may diverge over time.
298
+ */
299
+ 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 & {});
300
+ /**
301
+ * Provider-options schema for `google.interactions(...)` calls. Read from the
302
+ * shared `providerOptions.google.*` namespace (per PRD); per-call options that
303
+ * the AI SDK doesn't natively expose live here.
304
+ *
305
+ * All fields are `.nullish()` per the existing google provider convention.
306
+ */
307
+ declare const googleInteractionsLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
308
+ previousInteractionId?: string | null | undefined;
309
+ store?: boolean | null | undefined;
310
+ agent?: string | null | undefined;
311
+ agentConfig?: {
312
+ [x: string]: unknown;
313
+ type: "dynamic";
314
+ } | {
315
+ type: "deep-research";
316
+ thinkingSummaries?: "auto" | "none" | null | undefined;
317
+ visualization?: "auto" | "off" | null | undefined;
318
+ collaborativePlanning?: boolean | null | undefined;
319
+ } | null | undefined;
320
+ thinkingLevel?: "minimal" | "low" | "medium" | "high" | null | undefined;
321
+ thinkingSummaries?: "auto" | "none" | null | undefined;
322
+ responseFormat?: ({
323
+ [x: string]: unknown;
324
+ type: "text";
325
+ mimeType?: string | null | undefined;
326
+ schema?: unknown;
327
+ } | {
328
+ [x: string]: unknown;
329
+ type: "image";
330
+ mimeType?: string | null | undefined;
331
+ aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "1:8" | "8:1" | "1:4" | "4:1" | null | undefined;
332
+ imageSize?: "1K" | "2K" | "4K" | "512" | null | undefined;
333
+ } | {
334
+ [x: string]: unknown;
335
+ type: "audio";
336
+ mimeType?: string | null | undefined;
337
+ })[] | null | undefined;
338
+ imageConfig?: {
339
+ aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "1:8" | "8:1" | "1:4" | "4:1" | null | undefined;
340
+ imageSize?: "1K" | "2K" | "4K" | "512" | null | undefined;
341
+ } | null | undefined;
342
+ mediaResolution?: "low" | "medium" | "high" | "ultra_high" | null | undefined;
343
+ responseModalities?: ("text" | "image" | "document" | "audio" | "video")[] | null | undefined;
344
+ serviceTier?: "standard" | "flex" | "priority" | null | undefined;
345
+ systemInstruction?: string | null | undefined;
346
+ signature?: string | null | undefined;
347
+ interactionId?: string | null | undefined;
348
+ pollingTimeoutMs?: number | null | undefined;
349
+ background?: boolean | null | undefined;
350
+ environment?: string | {
351
+ type: "remote";
352
+ sources?: ({
353
+ type: "gcs";
354
+ source: string;
355
+ target?: string | null | undefined;
356
+ } | {
357
+ type: "repository";
358
+ source: string;
359
+ target?: string | null | undefined;
360
+ } | {
361
+ type: "inline";
362
+ content: string;
363
+ target: string;
364
+ })[] | null | undefined;
365
+ network?: "disabled" | {
366
+ allowlist: {
367
+ domain: string;
368
+ transform?: Record<string, string>[] | null | undefined;
369
+ }[];
370
+ } | null | undefined;
371
+ } | null | undefined;
372
+ }>;
373
+ type GoogleLanguageModelInteractionsOptions = InferSchema<typeof googleInteractionsLanguageModelOptions>;
374
+
375
+ /**
376
+ * Provider-metadata shape that the Gemini Interactions language model writes
377
+ * onto `result.providerMetadata.google` (and reads back from input messages on
378
+ * the next turn for stateful chaining and signature round-trip).
379
+ */
380
+ type GoogleInteractionsProviderMetadata = {
381
+ /**
382
+ * Gemini-server-side interaction id (`Interaction.id`). Pass back in
383
+ * `providerOptions.google.previousInteractionId` to chain stateful turns.
384
+ */
385
+ interactionId?: string;
386
+ /**
387
+ * Service tier used for this interaction (passthrough for observability).
388
+ */
389
+ serviceTier?: string;
390
+ /**
391
+ * Per-block signature hash for backend validation. Set by the SDK on output
392
+ * reasoning / tool-call parts and round-tripped on input parts.
393
+ */
394
+ signature?: string;
395
+ };
396
+
397
+ /**
398
+ * Type-only module: declares the union of supported Gemini Interactions agent
399
+ * names. Used by the `google.interactions({ agent })` factory branch.
400
+ *
401
+ * Strict string-literal union: unknown agent names are a compile-time error.
402
+ * User-defined agents (created via the `/agents` endpoint) are addressed by
403
+ * a separate `{ managedAgent: string }` factory shape — see
404
+ * `GoogleInteractionsModelInput`.
405
+ */
406
+ type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026' | 'antigravity-preview-05-2026';
407
+
214
408
  declare const googleTools: {
215
409
  /**
216
410
  * Creates a Google search tool that gives Google direct access to real-time web content.
217
411
  * Must have name "google_search".
218
412
  */
219
- googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
413
+ googleSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
220
414
  [x: string]: unknown;
221
415
  searchTypes?: {
222
416
  webSearch?: Record<string, never> | undefined;
@@ -226,7 +420,7 @@ declare const googleTools: {
226
420
  startTime: string;
227
421
  endTime: string;
228
422
  } | undefined;
229
- }>;
423
+ }, {}>;
230
424
  /**
231
425
  * Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
232
426
  * Designed for highly-regulated industries (finance, healthcare, public sector).
@@ -237,7 +431,7 @@ declare const googleTools: {
237
431
  *
238
432
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
239
433
  */
240
- enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
434
+ enterpriseWebSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
241
435
  /**
242
436
  * Creates a Google Maps grounding tool that gives the model access to Google Maps data.
243
437
  * Must have name "google_maps".
@@ -245,12 +439,12 @@ declare const googleTools: {
245
439
  * @see https://ai.google.dev/gemini-api/docs/maps-grounding
246
440
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
247
441
  */
248
- googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
442
+ googleMaps: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
249
443
  /**
250
444
  * Creates a URL context tool that gives Google direct access to real-time web content.
251
445
  * Must have name "url_context".
252
446
  */
253
- urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
447
+ urlContext: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
254
448
  /**
255
449
  * Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.
256
450
  * Must have name "file_search".
@@ -261,12 +455,12 @@ declare const googleTools: {
261
455
  *
262
456
  * @see https://ai.google.dev/gemini-api/docs/file-search
263
457
  */
264
- fileSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
458
+ fileSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
265
459
  [x: string]: unknown;
266
460
  fileSearchStoreNames: string[];
267
461
  topK?: number | undefined;
268
462
  metadataFilter?: string | undefined;
269
- }>;
463
+ }, {}>;
270
464
  /**
271
465
  * A tool that enables the model to generate and run Python code.
272
466
  * Must have name "code_execution".
@@ -277,62 +471,93 @@ declare const googleTools: {
277
471
  * @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)
278
472
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)
279
473
  */
280
- codeExecution: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
474
+ codeExecution: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{
281
475
  language: string;
282
476
  code: string;
283
477
  }, {
284
478
  outcome: string;
285
479
  output: string;
286
- }, {}>;
480
+ }, {}, {}>;
287
481
  /**
288
482
  * Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.
289
483
  * Must have name "vertex_rag_store".
290
484
  */
291
- vertexRagStore: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
485
+ vertexRagStore: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
292
486
  ragCorpus: string;
293
487
  topK?: number;
294
- }>;
488
+ }, {}>;
295
489
  };
296
490
 
297
- interface GoogleGenerativeAIProvider extends ProviderV3 {
298
- (modelId: GoogleGenerativeAIModelId): LanguageModelV3;
299
- languageModel(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
300
- chat(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
491
+ type GoogleImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | 'gemini-3.1-flash-image-preview' | (string & {});
492
+ interface GoogleImageSettings {
493
+ /**
494
+ * Override the maximum number of images per call (default 4)
495
+ */
496
+ maxImagesPerCall?: number;
497
+ }
498
+
499
+ interface GoogleProvider extends ProviderV4 {
500
+ (modelId: GoogleModelId): LanguageModelV4;
501
+ languageModel(modelId: GoogleModelId): LanguageModelV4;
502
+ chat(modelId: GoogleModelId): LanguageModelV4;
301
503
  /**
302
504
  * Creates a model for image generation.
303
505
  */
304
- image(modelId: GoogleGenerativeAIImageModelId, settings?: GoogleGenerativeAIImageSettings): ImageModelV3;
506
+ image(modelId: GoogleImageModelId, settings?: GoogleImageSettings): ImageModelV4;
305
507
  /**
306
508
  * @deprecated Use `chat()` instead.
307
509
  */
308
- generativeAI(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
510
+ generativeAI(modelId: GoogleModelId): LanguageModelV4;
309
511
  /**
310
512
  * Creates a model for text embeddings.
311
513
  */
312
- embedding(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV3;
514
+ embedding(modelId: GoogleEmbeddingModelId): EmbeddingModelV4;
313
515
  /**
314
516
  * Creates a model for text embeddings.
315
517
  */
316
- embeddingModel(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV3;
518
+ embeddingModel(modelId: GoogleEmbeddingModelId): EmbeddingModelV4;
317
519
  /**
318
520
  * @deprecated Use `embedding` instead.
319
521
  */
320
- textEmbedding(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV3;
522
+ textEmbedding(modelId: GoogleEmbeddingModelId): EmbeddingModelV4;
321
523
  /**
322
524
  * @deprecated Use `embeddingModel` instead.
323
525
  */
324
- textEmbeddingModel(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV3;
526
+ textEmbeddingModel(modelId: GoogleEmbeddingModelId): EmbeddingModelV4;
325
527
  /**
326
528
  * Creates a model for video generation.
327
529
  */
328
- video(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
530
+ video(modelId: GoogleVideoModelId): Experimental_VideoModelV4;
329
531
  /**
330
532
  * Creates a model for video generation.
331
533
  */
332
- videoModel(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
534
+ videoModel(modelId: GoogleVideoModelId): Experimental_VideoModelV4;
535
+ /**
536
+ * Creates a model for speech generation (text-to-speech).
537
+ */
538
+ speech(modelId: GoogleSpeechModelId): SpeechModelV4;
539
+ /**
540
+ * Creates a model for speech generation (text-to-speech).
541
+ */
542
+ speechModel(modelId: GoogleSpeechModelId): SpeechModelV4;
543
+ files(): FilesV4;
544
+ /**
545
+ * Creates a language model targeting the Gemini Interactions API
546
+ * (`POST /v1beta/interactions`). Pass:
547
+ * - a model ID (string),
548
+ * - `{ agent: <name> }` to use a known Gemini agent preset, or
549
+ * - `{ managedAgent: <name> }` to use a user-defined agent created via
550
+ * the `/v1beta/agents` endpoint.
551
+ */
552
+ interactions(modelIdOrAgent: GoogleInteractionsModelId | {
553
+ agent: GoogleInteractionsAgentName;
554
+ } | {
555
+ managedAgent: string;
556
+ }): LanguageModelV4;
557
+ experimental_realtime: Experimental_RealtimeFactoryV4;
333
558
  tools: typeof googleTools;
334
559
  }
335
- interface GoogleGenerativeAIProviderSettings {
560
+ interface GoogleProviderSettings {
336
561
  /**
337
562
  * Use a different URL prefix for API calls, e.g. to use proxy servers.
338
563
  * The default prefix is `https://generativelanguage.googleapis.com/v1beta`.
@@ -363,14 +588,40 @@ interface GoogleGenerativeAIProviderSettings {
363
588
  name?: string;
364
589
  }
365
590
  /**
366
- * Create a Google Generative AI provider instance.
591
+ * Create a Google provider instance.
367
592
  */
368
- declare function createGoogleGenerativeAI(options?: GoogleGenerativeAIProviderSettings): GoogleGenerativeAIProvider;
593
+ declare function createGoogle(options?: GoogleProviderSettings): GoogleProvider;
369
594
  /**
370
595
  * Default Google Generative AI provider instance.
371
596
  */
372
- declare const google: GoogleGenerativeAIProvider;
597
+ declare const google: GoogleProvider;
598
+
599
+ type GoogleRealtimeModelConfig = {
600
+ provider: string;
601
+ baseURL: string;
602
+ headers: () => Record<string, string | undefined>;
603
+ fetch?: FetchFunction;
604
+ };
605
+ declare class GoogleRealtimeModel implements Experimental_RealtimeModelV4 {
606
+ readonly specificationVersion: "v4";
607
+ readonly provider: string;
608
+ readonly modelId: string;
609
+ private readonly config;
610
+ private readonly mapper;
611
+ constructor(modelId: string, config: GoogleRealtimeModelConfig);
612
+ doCreateClientSecret(options: Experimental_RealtimeModelV4ClientSecretOptions): Promise<Experimental_RealtimeModelV4ClientSecretResult>;
613
+ getWebSocketConfig(options: {
614
+ token: string;
615
+ url: string;
616
+ }): {
617
+ url: string;
618
+ protocols?: string[];
619
+ };
620
+ parseServerEvent(raw: unknown): Experimental_RealtimeModelV4ServerEvent | Experimental_RealtimeModelV4ServerEvent[];
621
+ serializeClientEvent(event: Experimental_RealtimeModelV4ClientEvent): ReturnType<Experimental_RealtimeModelV4['serializeClientEvent']>;
622
+ buildSessionConfig(config: Experimental_RealtimeModelV4SessionConfig): Record<string, unknown>;
623
+ }
373
624
 
374
625
  declare const VERSION: string;
375
626
 
376
- export { type GoogleEmbeddingModelOptions, type GoogleErrorData, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, type GoogleGenerativeAIVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleImageModelOptions, type GoogleLanguageModelOptions, type GoogleVideoModelOptions, VERSION, createGoogleGenerativeAI, google };
627
+ export { GoogleRealtimeModel as Experimental_GoogleRealtimeModel, type GoogleRealtimeModelConfig as Experimental_GoogleRealtimeModelConfig, type GoogleEmbeddingModelOptions, type GoogleErrorData, type GoogleFilesUploadOptions, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleProvider as GoogleGenerativeAIProvider, type GoogleProviderMetadata as GoogleGenerativeAIProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleProviderSettings as GoogleGenerativeAIProviderSettings, type GoogleVideoModelId as GoogleGenerativeAIVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleImageModelOptions, type GoogleInteractionsAgentName, type GoogleInteractionsModelId, type GoogleInteractionsProviderMetadata, type GoogleLanguageModelInteractionsOptions, type GoogleLanguageModelOptions, type GoogleProvider, type GoogleProviderMetadata, type GoogleProviderSettings, type GoogleSpeechModelId, type GoogleSpeechModelOptions, type GoogleVideoModelId, type GoogleVideoModelOptions, VERSION, createGoogle, createGoogle as createGoogleGenerativeAI, google };