@ai-sdk/google 3.0.66 → 3.0.68

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
+ ## 3.0.68
4
+
5
+ ### Patch Changes
6
+
7
+ - e0f8c9e: feat(provider/google): add support for the Gemini Interactions API
8
+
9
+ ## 3.0.67
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [7beadf0]
14
+ - @ai-sdk/provider-utils@4.0.26
15
+
3
16
  ## 3.0.66
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -254,6 +254,87 @@ type GoogleVideoModelOptions = {
254
254
  [key: string]: unknown;
255
255
  };
256
256
 
257
+ /**
258
+ * Type-only union of Gemini model IDs that the Interactions API accepts via
259
+ * `model:`. Mirrors `Model` from `googleapis/js-genai`
260
+ * `src/interactions/resources/interactions.ts`.
261
+ *
262
+ * Kept as a separate type from `GoogleModelId` even though most IDs overlap;
263
+ * the two surfaces (`:generateContent` vs `/interactions`) are independent and
264
+ * may diverge over time.
265
+ */
266
+ 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' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
267
+ /**
268
+ * Provider-options schema for `google.interactions(...)` calls. Read from the
269
+ * shared `providerOptions.google.*` namespace (per PRD); per-call options that
270
+ * the AI SDK doesn't natively expose live here.
271
+ *
272
+ * All fields are `.nullish()` per the existing google provider convention.
273
+ */
274
+ declare const googleInteractionsLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
275
+ previousInteractionId?: string | null | undefined;
276
+ store?: boolean | null | undefined;
277
+ agent?: string | null | undefined;
278
+ agentConfig?: {
279
+ [x: string]: unknown;
280
+ type: "dynamic";
281
+ } | {
282
+ type: "deep-research";
283
+ thinkingSummaries?: "auto" | "none" | null | undefined;
284
+ visualization?: "auto" | "off" | null | undefined;
285
+ collaborativePlanning?: boolean | null | undefined;
286
+ } | null | undefined;
287
+ thinkingLevel?: "minimal" | "low" | "medium" | "high" | null | undefined;
288
+ thinkingSummaries?: "auto" | "none" | null | undefined;
289
+ imageConfig?: {
290
+ 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;
291
+ imageSize?: "1K" | "2K" | "4K" | "512" | null | undefined;
292
+ } | null | undefined;
293
+ mediaResolution?: "low" | "medium" | "high" | "ultra_high" | null | undefined;
294
+ responseModalities?: ("text" | "image" | "document" | "video" | "audio")[] | null | undefined;
295
+ serviceTier?: "standard" | "flex" | "priority" | null | undefined;
296
+ systemInstruction?: string | null | undefined;
297
+ signature?: string | null | undefined;
298
+ interactionId?: string | null | undefined;
299
+ pollingTimeoutMs?: number | null | undefined;
300
+ }>;
301
+ type GoogleLanguageModelInteractionsOptions = InferSchema<typeof googleInteractionsLanguageModelOptions>;
302
+
303
+ /**
304
+ * Provider-metadata shape that the Gemini Interactions language model writes
305
+ * onto `result.providerMetadata.google` (and reads back from input messages on
306
+ * the next turn for stateful chaining and signature round-trip).
307
+ */
308
+ type GoogleInteractionsProviderMetadata = {
309
+ /**
310
+ * Gemini-server-side interaction id (`Interaction.id`). Pass back in
311
+ * `providerOptions.google.previousInteractionId` to chain stateful turns.
312
+ */
313
+ interactionId?: string;
314
+ /**
315
+ * Service tier used for this interaction (passthrough for observability).
316
+ */
317
+ serviceTier?: string;
318
+ /**
319
+ * Per-block signature hash for backend validation. Set by the SDK on output
320
+ * reasoning / tool-call parts and round-tripped on input parts.
321
+ */
322
+ signature?: string;
323
+ };
324
+
325
+ /**
326
+ * Type-only module: declares the union of supported Gemini Interactions agent
327
+ * names. Used by the `google.interactions({ agent })` factory branch.
328
+ *
329
+ * Sourced from `googleapis/js-genai` `src/interactions/resources/interactions.ts`
330
+ * (`Interaction.agent` enum). Subject to expansion as Google adds new agents.
331
+ *
332
+ * This is a strict string-literal union (no `string` escape hatch) so that
333
+ * passing an unknown agent name is a compile-time error. Add new agents here
334
+ * as Google publishes them.
335
+ */
336
+ type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026';
337
+
257
338
  declare const googleTools: {
258
339
  /**
259
340
  * Creates a Google search tool that gives Google direct access to real-time web content.
@@ -373,6 +454,14 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
373
454
  * Creates a model for video generation.
374
455
  */
375
456
  videoModel(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
457
+ /**
458
+ * Creates a language model targeting the Gemini Interactions API
459
+ * (`POST /v1beta/interactions`). Pass either a model ID (string) or
460
+ * `{ agent: <name> }` to use a Gemini agent preset.
461
+ */
462
+ interactions(modelIdOrAgent: GoogleInteractionsModelId | {
463
+ agent: GoogleInteractionsAgentName;
464
+ }): LanguageModelV3;
376
465
  tools: typeof googleTools;
377
466
  }
378
467
  interface GoogleGenerativeAIProviderSettings {
@@ -416,4 +505,4 @@ declare const google: GoogleGenerativeAIProvider;
416
505
 
417
506
  declare const VERSION: string;
418
507
 
419
- 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 };
508
+ 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 GoogleInteractionsAgentName, type GoogleInteractionsModelId, type GoogleInteractionsProviderMetadata, type GoogleLanguageModelInteractionsOptions, type GoogleLanguageModelOptions, type GoogleVideoModelOptions, VERSION, createGoogleGenerativeAI, google };
package/dist/index.d.ts CHANGED
@@ -254,6 +254,87 @@ type GoogleVideoModelOptions = {
254
254
  [key: string]: unknown;
255
255
  };
256
256
 
257
+ /**
258
+ * Type-only union of Gemini model IDs that the Interactions API accepts via
259
+ * `model:`. Mirrors `Model` from `googleapis/js-genai`
260
+ * `src/interactions/resources/interactions.ts`.
261
+ *
262
+ * Kept as a separate type from `GoogleModelId` even though most IDs overlap;
263
+ * the two surfaces (`:generateContent` vs `/interactions`) are independent and
264
+ * may diverge over time.
265
+ */
266
+ 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' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
267
+ /**
268
+ * Provider-options schema for `google.interactions(...)` calls. Read from the
269
+ * shared `providerOptions.google.*` namespace (per PRD); per-call options that
270
+ * the AI SDK doesn't natively expose live here.
271
+ *
272
+ * All fields are `.nullish()` per the existing google provider convention.
273
+ */
274
+ declare const googleInteractionsLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
275
+ previousInteractionId?: string | null | undefined;
276
+ store?: boolean | null | undefined;
277
+ agent?: string | null | undefined;
278
+ agentConfig?: {
279
+ [x: string]: unknown;
280
+ type: "dynamic";
281
+ } | {
282
+ type: "deep-research";
283
+ thinkingSummaries?: "auto" | "none" | null | undefined;
284
+ visualization?: "auto" | "off" | null | undefined;
285
+ collaborativePlanning?: boolean | null | undefined;
286
+ } | null | undefined;
287
+ thinkingLevel?: "minimal" | "low" | "medium" | "high" | null | undefined;
288
+ thinkingSummaries?: "auto" | "none" | null | undefined;
289
+ imageConfig?: {
290
+ 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;
291
+ imageSize?: "1K" | "2K" | "4K" | "512" | null | undefined;
292
+ } | null | undefined;
293
+ mediaResolution?: "low" | "medium" | "high" | "ultra_high" | null | undefined;
294
+ responseModalities?: ("text" | "image" | "document" | "video" | "audio")[] | null | undefined;
295
+ serviceTier?: "standard" | "flex" | "priority" | null | undefined;
296
+ systemInstruction?: string | null | undefined;
297
+ signature?: string | null | undefined;
298
+ interactionId?: string | null | undefined;
299
+ pollingTimeoutMs?: number | null | undefined;
300
+ }>;
301
+ type GoogleLanguageModelInteractionsOptions = InferSchema<typeof googleInteractionsLanguageModelOptions>;
302
+
303
+ /**
304
+ * Provider-metadata shape that the Gemini Interactions language model writes
305
+ * onto `result.providerMetadata.google` (and reads back from input messages on
306
+ * the next turn for stateful chaining and signature round-trip).
307
+ */
308
+ type GoogleInteractionsProviderMetadata = {
309
+ /**
310
+ * Gemini-server-side interaction id (`Interaction.id`). Pass back in
311
+ * `providerOptions.google.previousInteractionId` to chain stateful turns.
312
+ */
313
+ interactionId?: string;
314
+ /**
315
+ * Service tier used for this interaction (passthrough for observability).
316
+ */
317
+ serviceTier?: string;
318
+ /**
319
+ * Per-block signature hash for backend validation. Set by the SDK on output
320
+ * reasoning / tool-call parts and round-tripped on input parts.
321
+ */
322
+ signature?: string;
323
+ };
324
+
325
+ /**
326
+ * Type-only module: declares the union of supported Gemini Interactions agent
327
+ * names. Used by the `google.interactions({ agent })` factory branch.
328
+ *
329
+ * Sourced from `googleapis/js-genai` `src/interactions/resources/interactions.ts`
330
+ * (`Interaction.agent` enum). Subject to expansion as Google adds new agents.
331
+ *
332
+ * This is a strict string-literal union (no `string` escape hatch) so that
333
+ * passing an unknown agent name is a compile-time error. Add new agents here
334
+ * as Google publishes them.
335
+ */
336
+ type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026';
337
+
257
338
  declare const googleTools: {
258
339
  /**
259
340
  * Creates a Google search tool that gives Google direct access to real-time web content.
@@ -373,6 +454,14 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
373
454
  * Creates a model for video generation.
374
455
  */
375
456
  videoModel(modelId: GoogleGenerativeAIVideoModelId): Experimental_VideoModelV3;
457
+ /**
458
+ * Creates a language model targeting the Gemini Interactions API
459
+ * (`POST /v1beta/interactions`). Pass either a model ID (string) or
460
+ * `{ agent: <name> }` to use a Gemini agent preset.
461
+ */
462
+ interactions(modelIdOrAgent: GoogleInteractionsModelId | {
463
+ agent: GoogleInteractionsAgentName;
464
+ }): LanguageModelV3;
376
465
  tools: typeof googleTools;
377
466
  }
378
467
  interface GoogleGenerativeAIProviderSettings {
@@ -416,4 +505,4 @@ declare const google: GoogleGenerativeAIProvider;
416
505
 
417
506
  declare const VERSION: string;
418
507
 
419
- 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 };
508
+ 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 GoogleInteractionsAgentName, type GoogleInteractionsModelId, type GoogleInteractionsProviderMetadata, type GoogleLanguageModelInteractionsOptions, type GoogleLanguageModelOptions, type GoogleVideoModelOptions, VERSION, createGoogleGenerativeAI, google };