@ai-sdk/google-vertex 5.0.118 → 5.0.120

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.
@@ -4,6 +4,8 @@ import {
4
4
  type TranscriptionModelV4,
5
5
  } from '@ai-sdk/provider';
6
6
  import {
7
+ lazySchema,
8
+ zodSchema,
7
9
  combineHeaders,
8
10
  convertUint8ArrayToBase64,
9
11
  createJsonResponseHandler,
@@ -211,33 +213,37 @@ export class GoogleVertexTranscriptionModel implements TranscriptionModelV4 {
211
213
 
212
214
  // Minimal schema: only the fields the implementation reads, with `.nullish()`
213
215
  // so provider API changes don't break parsing.
214
- const googleVertexTranscriptionResponseSchema = z.object({
215
- results: z
216
- .array(
217
- z.object({
218
- alternatives: z
219
- .array(
220
- z.object({
221
- transcript: z.string().nullish(),
222
- words: z
223
- .array(
224
- z.object({
225
- word: z.string().nullish(),
226
- startOffset: z.string().nullish(),
227
- endOffset: z.string().nullish(),
228
- }),
229
- )
230
- .nullish(),
231
- }),
232
- )
233
- .nullish(),
234
- languageCode: z.string().nullish(),
235
- }),
236
- )
237
- .nullish(),
238
- metadata: z
239
- .object({
240
- totalBilledDuration: z.string().nullish(),
241
- })
242
- .nullish(),
243
- });
216
+ const googleVertexTranscriptionResponseSchema = lazySchema(() =>
217
+ zodSchema(
218
+ z.object({
219
+ results: z
220
+ .array(
221
+ z.object({
222
+ alternatives: z
223
+ .array(
224
+ z.object({
225
+ transcript: z.string().nullish(),
226
+ words: z
227
+ .array(
228
+ z.object({
229
+ word: z.string().nullish(),
230
+ startOffset: z.string().nullish(),
231
+ endOffset: z.string().nullish(),
232
+ }),
233
+ )
234
+ .nullish(),
235
+ }),
236
+ )
237
+ .nullish(),
238
+ languageCode: z.string().nullish(),
239
+ }),
240
+ )
241
+ .nullish(),
242
+ metadata: z
243
+ .object({
244
+ totalBilledDuration: z.string().nullish(),
245
+ })
246
+ .nullish(),
247
+ }),
248
+ ),
249
+ );
@@ -9,6 +9,9 @@ import {
9
9
  type SharedV4Warning,
10
10
  } from '@ai-sdk/provider';
11
11
  import {
12
+ lazySchema,
13
+ zodSchema,
14
+ type InferSchema,
12
15
  combineHeaders,
13
16
  convertUint8ArrayToBase64,
14
17
  createJsonResponseHandler,
@@ -443,30 +446,34 @@ export class GoogleVertexVideoModel implements VideoModelV4 {
443
446
  }
444
447
  }
445
448
 
446
- const googleVertexOperationSchema = z.object({
447
- name: z.string().nullish(),
448
- done: z.boolean().nullish(),
449
- error: z
450
- .object({
451
- code: z.number().nullish(),
452
- message: z.string(),
453
- status: z.string().nullish(),
454
- })
455
- .nullish(),
456
- response: z
457
- .object({
458
- videos: z
459
- .array(
460
- z.object({
461
- bytesBase64Encoded: z.string().nullish(),
462
- gcsUri: z.string().nullish(),
463
- mimeType: z.string().nullish(),
464
- }),
465
- )
449
+ const googleVertexOperationSchema = lazySchema(() =>
450
+ zodSchema(
451
+ z.object({
452
+ name: z.string().nullish(),
453
+ done: z.boolean().nullish(),
454
+ error: z
455
+ .object({
456
+ code: z.number().nullish(),
457
+ message: z.string(),
458
+ status: z.string().nullish(),
459
+ })
466
460
  .nullish(),
467
- raiMediaFilteredCount: z.number().nullish(),
468
- })
469
- .nullish(),
470
- });
461
+ response: z
462
+ .object({
463
+ videos: z
464
+ .array(
465
+ z.object({
466
+ bytesBase64Encoded: z.string().nullish(),
467
+ gcsUri: z.string().nullish(),
468
+ mimeType: z.string().nullish(),
469
+ }),
470
+ )
471
+ .nullish(),
472
+ raiMediaFilteredCount: z.number().nullish(),
473
+ })
474
+ .nullish(),
475
+ }),
476
+ ),
477
+ );
471
478
 
472
- type VertexOperation = z.infer<typeof googleVertexOperationSchema>;
479
+ type VertexOperation = InferSchema<typeof googleVertexOperationSchema>;