@ai-sdk/google 4.0.57 → 4.0.59

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.
@@ -1262,8 +1262,8 @@ The [Gemini Interactions API](https://ai.google.dev/gemini-api/docs/interactions
1262
1262
  (`POST /v1beta/interactions`) is a separate Google endpoint with server-side
1263
1263
  state, unified content blocks, first-class built-in tools, agent presets,
1264
1264
  managed agents that run in a sandboxed Linux environment, and native
1265
- multimodal image output. It is reached via the `google.interactions(...)`
1266
- factory:
1265
+ multimodal image and video output. It is reached via the
1266
+ `google.interactions(...)` factory:
1267
1267
 
1268
1268
  ```ts
1269
1269
  import { google } from '@ai-sdk/google';
@@ -1355,17 +1355,42 @@ The following optional provider options are available:
1355
1355
  Whether the model returns synthesized thought summaries on reasoning
1356
1356
  parts. Defaults to the API default.
1357
1357
 
1358
- - **responseFormat** _Array\<\{ type: 'text' | 'image' | 'audio'; mimeType?: string; schema?: unknown; aspectRatio?: string; imageSize?: '1K' \| '2K' \| '4K' \| '512' \}\>_
1358
+ - **responseFormat** _Array\<ResponseFormatEntry\>_
1359
1359
 
1360
1360
  Output-format entries that map directly to the API's `response_format`
1361
- array. Use this for fine-grained control over image, audio, or non-JSON
1362
- text outputs (e.g. `aspectRatio` and `imageSize` for image generation).
1361
+ array. Entries have the following shape:
1362
+
1363
+ ```ts
1364
+ type ResponseFormatEntry =
1365
+ | { type: 'text'; mimeType?: string; schema?: unknown }
1366
+ | {
1367
+ type: 'image';
1368
+ mimeType?: string;
1369
+ aspectRatio?: string;
1370
+ imageSize?: '1K' | '2K' | '4K' | '512';
1371
+ }
1372
+ | { type: 'audio'; mimeType?: string }
1373
+ | {
1374
+ type: 'video';
1375
+ aspectRatio?: '16:9' | '9:16';
1376
+ resolution?: '360p' | '720p' | '1080p' | '4k';
1377
+ duration?: string;
1378
+ delivery?: 'inline' | 'uri';
1379
+ gcsUri?: string;
1380
+ };
1381
+ ```
1382
+
1383
+ Use this for fine-grained control over image, audio, video, or non-JSON
1384
+ text outputs. Video entries can control aspect ratio, resolution, duration,
1385
+ and inline or URI delivery; set `gcsUri` when delivering to Google Cloud
1386
+ Storage. Inline videos are returned in `result.files` by `generateText` and
1387
+ emitted as `file` parts by `streamText`.
1363
1388
  The AI SDK call-level `responseFormat: { type: 'json', schema }` still
1364
1389
  drives JSON-mode automatically and prepends a matching text entry;
1365
1390
  entries listed here are appended.
1366
1391
 
1367
- `aspectRatio` accepts `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`,
1368
- `9:16`, `16:9`, `21:9`, `1:8`, `8:1`, `1:4`, `4:1`.
1392
+ For image entries, `aspectRatio` accepts `1:1`, `2:3`, `3:2`, `3:4`, `4:3`,
1393
+ `4:5`, `5:4`, `9:16`, `16:9`, `21:9`, `1:8`, `8:1`, `1:4`, `4:1`.
1369
1394
 
1370
1395
  - **imageConfig** _\{ aspectRatio?: string; imageSize?: '1K' | '2K' | '4K' | '512' \}_ (deprecated)
1371
1396
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "4.0.57",
3
+ "version": "4.0.59",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -35,8 +35,8 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@ai-sdk/provider": "4.0.8",
39
- "@ai-sdk/provider-utils": "5.0.33"
38
+ "@ai-sdk/provider": "4.0.9",
39
+ "@ai-sdk/provider-utils": "5.0.34"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@ai-sdk/test-server": "2.0.1",
@@ -75,8 +75,8 @@ export const googleInteractionsLanguageModelOptions = lazySchema(() =>
75
75
 
76
76
  /**
77
77
  * Output-format entries that map directly to the API's `response_format`
78
- * array. Use this to request image, audio, or non-JSON text outputs
79
- * with full control over `mime_type`, `aspect_ratio`, and `image_size`.
78
+ * array. Use this to request image, audio, video, or non-JSON text
79
+ * outputs with modality-specific controls.
80
80
  *
81
81
  * Entries are sent in order. The AI SDK call-level `responseFormat: {
82
82
  * type: 'json', schema }` still drives JSON-mode and adds a matching
@@ -123,6 +123,16 @@ export const googleInteractionsLanguageModelOptions = lazySchema(() =>
123
123
  mimeType: z.string().nullish(),
124
124
  })
125
125
  .loose(),
126
+ z
127
+ .object({
128
+ type: z.literal('video'),
129
+ aspectRatio: z.enum(['16:9', '9:16']).nullish(),
130
+ resolution: z.enum(['360p', '720p', '1080p', '4k']).nullish(),
131
+ duration: z.string().nullish(),
132
+ delivery: z.enum(['inline', 'uri']).nullish(),
133
+ gcsUri: z.string().nullish(),
134
+ })
135
+ .loose(),
126
136
  ]),
127
137
  )
128
138
  .nullish(),
@@ -245,6 +245,17 @@ export class GoogleInteractionsLanguageModel implements LanguageModelV4 {
245
245
  mime_type: entry.mimeType ?? undefined,
246
246
  }),
247
247
  );
248
+ } else if (entry.type === 'video') {
249
+ responseFormatEntries.push(
250
+ pruneUndefined({
251
+ type: 'video' as const,
252
+ aspect_ratio: entry.aspectRatio ?? undefined,
253
+ resolution: entry.resolution ?? undefined,
254
+ duration: entry.duration ?? undefined,
255
+ delivery: entry.delivery ?? undefined,
256
+ gcs_uri: entry.gcsUri ?? undefined,
257
+ }),
258
+ );
248
259
  }
249
260
  }
250
261
  }
@@ -434,6 +434,10 @@ export type GoogleInteractionsImageSize = '1K' | '2K' | '4K' | '512';
434
434
  *
435
435
  * { type: 'image', mime_type, aspect_ratio?, image_size? }
436
436
  * -- image generation. `mime_type` defaults to `image/png`.
437
+ *
438
+ * { type: 'video', aspect_ratio?, resolution?, duration?, delivery?,
439
+ * gcs_uri? }
440
+ * -- video generation and delivery configuration.
437
441
  */
438
442
  export type GoogleInteractionsResponseFormatTextEntry = {
439
443
  type: 'text';
@@ -453,10 +457,20 @@ export type GoogleInteractionsResponseFormatAudioEntry = {
453
457
  mime_type?: string;
454
458
  };
455
459
 
460
+ export type GoogleInteractionsResponseFormatVideoEntry = {
461
+ type: 'video';
462
+ aspect_ratio?: '16:9' | '9:16';
463
+ resolution?: '360p' | '720p' | '1080p' | '4k';
464
+ duration?: string;
465
+ delivery?: 'inline' | 'uri';
466
+ gcs_uri?: string;
467
+ };
468
+
456
469
  export type GoogleInteractionsResponseFormatEntry =
457
470
  | GoogleInteractionsResponseFormatTextEntry
458
471
  | GoogleInteractionsResponseFormatImageEntry
459
- | GoogleInteractionsResponseFormatAudioEntry;
472
+ | GoogleInteractionsResponseFormatAudioEntry
473
+ | GoogleInteractionsResponseFormatVideoEntry;
460
474
 
461
475
  export type GoogleInteractionsGenerationConfig = {
462
476
  temperature?: number;