@ai-sdk/google-vertex 5.0.131 → 5.0.133

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.
@@ -1,9 +1,33 @@
1
1
  import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, connectToWebSocket, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createJsonErrorResponseHandler, createJsonResponseHandler, generateId, getRuntimeEnvironmentUserAgent, isValidHostnamePart, lazySchema, loadOptionalSetting, loadSetting, normalizeHeaders, parseProviderOptions, postJsonToApi, resolve, safeParseJSON, serializeModelOptions, waitForWebSocketBufferDrain, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
2
- import { GoogleInteractionsLanguageModel, GoogleLanguageModel, GoogleSpeechModel, googleTools } from "@ai-sdk/google/internal";
2
+ import { GoogleInteractionsLanguageModel, GoogleLanguageModel, GoogleSpeechModel, getGoogleLanguageModelEntry, googleProviderOptions, googleTools } from "@ai-sdk/google/internal";
3
3
  import { AISDKError, InvalidArgumentError, LoadAPIKeyError, TooManyEmbeddingValuesForCallError } from "@ai-sdk/provider";
4
4
  import { z } from "zod/v4";
5
+ //#region src/google-vertex-model-catalog-config.ts
6
+ function requestConfig(modelId) {
7
+ const embedContent = modelId === "gemini-embedding-2" || modelId === "gemini-embedding-2-preview";
8
+ return {
9
+ language: {
10
+ endpoint: modelId.startsWith("endpoints/"),
11
+ maxOutputTokens: modelId === "meta/llama-4-maverick-17b-128e-instruct-maas" || modelId === "meta/llama-4-scout-17b-16e-instruct-maas" ? 8192 : void 0
12
+ },
13
+ image: { gemini: modelId.startsWith("gemini-") },
14
+ embedding: {
15
+ endpoint: embedContent ? "embedContent" : "predict",
16
+ maxEmbeddingsPerCall: embedContent ? 1 : 250
17
+ },
18
+ speech: { api: modelId.startsWith("chirp") ? "cloud-tts" : "gemini" },
19
+ transcription: {
20
+ api: modelId.startsWith("gemini") ? "gemini" : "cloud-speech",
21
+ live: modelId.includes("-live")
22
+ }
23
+ };
24
+ }
25
+ function getGoogleVertexRequestConfig(modelId) {
26
+ return requestConfig(modelId);
27
+ }
28
+ //#endregion
5
29
  //#region src/version.ts
6
- const VERSION = "5.0.131";
30
+ const VERSION = "5.0.133";
7
31
  //#endregion
8
32
  //#region src/google-vertex-error.ts
9
33
  const googleVertexErrorDataSchema = lazySchema(() => zodSchema(z.object({ error: z.object({
@@ -173,16 +197,482 @@ const googleVertexEmbedContentResponseSchema = lazySchema(() => zodSchema(z.obje
173
197
  usageMetadata: z.object({ promptTokenCount: z.number().nullish() }).nullish()
174
198
  })));
175
199
  function usesEmbedContentEndpoint(modelId) {
176
- return modelId === "gemini-embedding-2" || modelId === "gemini-embedding-2-preview";
200
+ return getGoogleVertexRequestConfig(modelId).embedding?.endpoint === "embedContent";
177
201
  }
178
202
  //#endregion
179
- //#region src/google-vertex-image-model.ts
180
- const googleVertexImageModelsWithFileInputSupport = /* @__PURE__ */ new Set([
203
+ //#region src/google-vertex-model-catalog.ts
204
+ const documentedImageDetails = {
205
+ "gemini-nano-banana-2.1": {
206
+ imageGeneration: true,
207
+ aspectRatios: [
208
+ "1:1",
209
+ "2:3",
210
+ "3:2",
211
+ "3:4",
212
+ "4:3",
213
+ "4:5",
214
+ "5:4",
215
+ "9:16",
216
+ "16:9",
217
+ "21:9",
218
+ "1:8",
219
+ "8:1",
220
+ "1:4",
221
+ "4:1"
222
+ ]
223
+ },
224
+ "gemini-3.1-flash-image-preview": {
225
+ imageGeneration: true,
226
+ aspectRatios: [
227
+ "1:1",
228
+ "2:3",
229
+ "3:2",
230
+ "3:4",
231
+ "4:3",
232
+ "4:5",
233
+ "5:4",
234
+ "9:16",
235
+ "16:9",
236
+ "21:9"
237
+ ]
238
+ },
239
+ "gemini-3-pro-image-preview": {
240
+ imageGeneration: true,
241
+ aspectRatios: [
242
+ "1:1",
243
+ "2:3",
244
+ "3:2",
245
+ "3:4",
246
+ "4:3",
247
+ "4:5",
248
+ "5:4",
249
+ "9:16",
250
+ "16:9",
251
+ "21:9"
252
+ ]
253
+ },
254
+ "gemini-2.5-flash-image": {
255
+ imageGeneration: true,
256
+ aspectRatios: [
257
+ "1:1",
258
+ "2:3",
259
+ "3:2",
260
+ "3:4",
261
+ "4:3",
262
+ "4:5",
263
+ "5:4",
264
+ "9:16",
265
+ "16:9",
266
+ "21:9"
267
+ ]
268
+ }
269
+ };
270
+ const documentedTranscriptionDetails = {
271
+ chirp_2: {
272
+ wordTimestampDescription: "Available with a potential quality and speed tradeoff",
273
+ languageDetectionDescription: "Auto detection with `['auto']`"
274
+ },
275
+ chirp_3: {
276
+ wordTimestampDescription: "Available with a potential transcription quality tradeoff",
277
+ languageDetectionDescription: "Auto detection with `['auto']`"
278
+ },
279
+ telephony: {
280
+ wordTimestampDescription: "Available",
281
+ languageDetectionDescription: "Explicit supported language codes, with alternative language detection support"
282
+ }
283
+ };
284
+ const googleVertexProviderOptions = {
285
+ language: googleProviderOptions.language,
286
+ image: Object.fromEntries(Object.entries(googleProviderOptions.language).filter(([key]) => key !== "responseModalities")),
287
+ embedding: {
288
+ outputDimensionality: { description: "Reduced output dimensions." },
289
+ taskType: { description: "Task for which embeddings are optimized." },
290
+ title: { description: "Document title; requires RETRIEVAL_DOCUMENT." },
291
+ autoTruncate: { description: "Truncate inputs exceeding the model context." }
292
+ },
293
+ speech: {
294
+ speechMetadata: { description: "Directions for Gemini 3.8 speech." },
295
+ turns: { description: "Structured transcript for Gemini 3.8 speech." },
296
+ multiSpeakerVoiceConfig: { description: "Voice configuration for dialogue speakers." }
297
+ },
298
+ transcription: {
299
+ languageCodes: { description: "Language hints or automatic language detection." },
300
+ enableAutomaticPunctuation: { description: "Include punctuation in Cloud Speech transcripts." },
301
+ enableWordTimeOffsets: { description: "Include Cloud Speech word timestamps." },
302
+ region: { description: "Cloud Speech region." },
303
+ customVocabulary: { description: "Vocabulary hints for Gemini transcription." },
304
+ wordTimestamp: { description: "Include Gemini word timestamps." },
305
+ diarization: { description: "Enable Gemini speaker diarization." },
306
+ mode: { description: "Verbatim or smart Gemini transcription formatting." }
307
+ },
308
+ video: {
309
+ pollIntervalMs: { description: "Polling interval." },
310
+ pollTimeoutMs: { description: "Polling timeout." },
311
+ personGeneration: { description: "Policy for generating people." },
312
+ negativePrompt: { description: "Content to avoid." },
313
+ generateAudio: { description: "Generate synchronized audio." },
314
+ gcsOutputDirectory: { description: "Cloud Storage output directory." },
315
+ referenceImages: { description: "Reference images for video generation." }
316
+ }
317
+ };
318
+ function languageEntry(modelId) {
319
+ const entry = getGoogleLanguageModelEntry(modelId);
320
+ return {
321
+ capabilities: { language: entry.capabilities.language },
322
+ providerOptions: { language: {
323
+ ...entry.providerOptions.language,
324
+ serviceTier: false
325
+ } },
326
+ requestConfig: { language: getGoogleVertexRequestConfig(modelId).language }
327
+ };
328
+ }
329
+ const imageModels = [
181
330
  "gemini-2.5-flash-image",
182
331
  "gemini-3-pro-image-preview",
183
332
  "gemini-3.1-flash-image-preview",
184
333
  "gemini-nano-banana-2.1"
185
- ]);
334
+ ];
335
+ function getGoogleVertexImageModelEntry(modelId) {
336
+ const known = imageModels.includes(modelId);
337
+ return {
338
+ capabilities: { image: {
339
+ sizes: { description: "Use aspectRatio; the size option is unsupported." },
340
+ fileInput: known ? true : "unknown",
341
+ maskInput: known ? false : "unknown",
342
+ maxImagesPerCall: 1,
343
+ ...documentedImageDetails[modelId]
344
+ } },
345
+ providerOptions: { image: Object.fromEntries(Object.keys(googleVertexProviderOptions.image).map((key) => [key, key === "serviceTier" ? false : { condition: "Support follows the Gemini language model and image configuration." }])) },
346
+ requestConfig: { image: getGoogleVertexRequestConfig(modelId).image }
347
+ };
348
+ }
349
+ function embeddingEntry(modelId) {
350
+ return {
351
+ capabilities: { embedding: {
352
+ defaultDimensions: modelId.startsWith("gemini-embedding-") ? 3072 : 768,
353
+ customDimensions: "unknown",
354
+ maxEmbeddingsPerCall: getGoogleVertexRequestConfig(modelId).embedding.maxEmbeddingsPerCall,
355
+ supportsParallelCalls: true,
356
+ multimodal: getGoogleVertexRequestConfig(modelId).embedding.endpoint === "embedContent"
357
+ } },
358
+ providerOptions: { embedding: {
359
+ outputDimensionality: "unknown",
360
+ taskType: "unknown",
361
+ title: { condition: "Requires RETRIEVAL_DOCUMENT." },
362
+ autoTruncate: true
363
+ } },
364
+ requestConfig: { embedding: getGoogleVertexRequestConfig(modelId).embedding }
365
+ };
366
+ }
367
+ function speechEntry(modelId) {
368
+ const chirp = getGoogleVertexRequestConfig(modelId).speech?.api === "cloud-tts";
369
+ return {
370
+ capabilities: { speech: {
371
+ instructions: !chirp,
372
+ multiSpeaker: !chirp
373
+ } },
374
+ providerOptions: { speech: {
375
+ multiSpeakerVoiceConfig: chirp ? false : true,
376
+ speechMetadata: chirp ? false : { condition: "Requires Gemini 3.8 TTS." },
377
+ turns: chirp ? false : { condition: "Requires Gemini 3.8 TTS." }
378
+ } },
379
+ requestConfig: { speech: getGoogleVertexRequestConfig(modelId).speech }
380
+ };
381
+ }
382
+ function transcriptionEntry(modelId) {
383
+ const config = getGoogleVertexRequestConfig(modelId).transcription;
384
+ const gemini = config.api === "gemini";
385
+ return {
386
+ capabilities: { transcription: {
387
+ transcription: !config.live,
388
+ streaming: config.live,
389
+ duration: gemini ? false : true,
390
+ segments: config.live ? false : { condition: "Requires word timestamps." },
391
+ language: true,
392
+ ...documentedTranscriptionDetails[modelId]
393
+ } },
394
+ providerOptions: { transcription: {
395
+ languageCodes: true,
396
+ enableAutomaticPunctuation: !gemini,
397
+ enableWordTimeOffsets: !gemini,
398
+ region: !gemini,
399
+ customVocabulary: gemini,
400
+ wordTimestamp: gemini,
401
+ diarization: gemini,
402
+ mode: gemini
403
+ } },
404
+ requestConfig: { transcription: config }
405
+ };
406
+ }
407
+ function videoEntry(modelId) {
408
+ const veo3 = modelId.startsWith("veo-3");
409
+ return {
410
+ capabilities: { video: {
411
+ inputs: {
412
+ text: true,
413
+ image: true,
414
+ firstFrame: true,
415
+ lastFrame: { condition: "Requires a Veo model supporting frame interpolation." },
416
+ referenceImage: { condition: "Requires a Veo model supporting reference images." },
417
+ referenceVideo: false
418
+ },
419
+ generateAudio: veo3,
420
+ aspectRatio: true,
421
+ resolution: true,
422
+ duration: true,
423
+ fps: false,
424
+ seed: true,
425
+ maxVideosPerCall: 4
426
+ } },
427
+ providerOptions: { video: {
428
+ pollIntervalMs: true,
429
+ pollTimeoutMs: true,
430
+ personGeneration: true,
431
+ negativePrompt: true,
432
+ generateAudio: veo3,
433
+ gcsOutputDirectory: true,
434
+ referenceImages: { condition: "Requires a Veo model supporting reference images." }
435
+ } }
436
+ };
437
+ }
438
+ [
439
+ ...[
440
+ "gemini-nano-banana-2.1",
441
+ "gemini-4-argon",
442
+ "gemini-3.8-flash",
443
+ "gemini-3.7-flash",
444
+ "gemini-3.6-flash",
445
+ "gemini-3.5-flash",
446
+ "gemini-3.5-flash-lite",
447
+ "gemini-2.5-pro",
448
+ "gemini-2.5-flash",
449
+ "gemini-2.5-flash-lite",
450
+ "gemini-2.0-flash-lite",
451
+ "gemini-2.0-flash",
452
+ "gemini-2.0-flash-001",
453
+ "gemini-1.5-flash",
454
+ "gemini-1.5-flash-001",
455
+ "gemini-1.5-flash-002",
456
+ "gemini-1.5-pro",
457
+ "gemini-1.5-pro-001",
458
+ "gemini-1.5-pro-002",
459
+ "gemini-1.0-pro-001",
460
+ "gemini-1.0-pro-vision-001",
461
+ "gemini-1.0-pro",
462
+ "gemini-1.0-pro-002",
463
+ "gemini-2.0-flash-lite-preview-02-05",
464
+ "gemini-2.5-flash-preview-09-2025",
465
+ "gemini-3-pro-preview",
466
+ "gemini-3-pro-image-preview",
467
+ "gemini-3-flash-preview",
468
+ "gemini-3.1-pro-preview",
469
+ "gemini-3.1-flash-image-preview",
470
+ "gemini-3.1-flash-lite-preview",
471
+ "gemini-2.0-pro-exp-02-05",
472
+ "gemini-2.0-flash-exp"
473
+ ].map((id) => [id, languageEntry(id)]),
474
+ ...[
475
+ "gemini-2.5-flash-image",
476
+ "gemini-3-pro-image-preview",
477
+ "gemini-3.1-flash-image-preview",
478
+ "gemini-nano-banana-2.1"
479
+ ].map((id) => [id, getGoogleVertexImageModelEntry(id)]),
480
+ ...[
481
+ "textembedding-gecko",
482
+ "textembedding-gecko@001",
483
+ "textembedding-gecko@003",
484
+ "textembedding-gecko-multilingual",
485
+ "textembedding-gecko-multilingual@001",
486
+ "text-multilingual-embedding-002",
487
+ "text-embedding-004",
488
+ "text-embedding-005",
489
+ "gemini-embedding-001",
490
+ "gemini-embedding-2",
491
+ "gemini-embedding-2-preview"
492
+ ].map((id) => [id, embeddingEntry(id)]),
493
+ ...[
494
+ "veo-2.0-generate-preview",
495
+ "veo-2.0-generate-exp",
496
+ "veo-2.0-generate-001",
497
+ "veo-3.0-generate-001",
498
+ "veo-3.0-fast-generate-001",
499
+ "veo-3.0-generate-preview",
500
+ "veo-3.0-fast-generate-preview",
501
+ "veo-3.1-generate-001",
502
+ "veo-3.1-fast-generate-001",
503
+ "veo-3.1-generate-preview",
504
+ "veo-3.1-fast-generate-preview"
505
+ ].map((id) => [id, videoEntry(id)]),
506
+ ...[
507
+ "gemini-2.5-flash-tts",
508
+ "gemini-2.5-pro-tts",
509
+ "gemini-2.5-flash-lite-preview-tts",
510
+ "gemini-3.1-flash-tts-preview",
511
+ "chirp-3-hd"
512
+ ].map((id) => [id, speechEntry(id)]),
513
+ ...[
514
+ "chirp_2",
515
+ "chirp_3",
516
+ "telephony"
517
+ ].map((id) => [id, transcriptionEntry(id)]),
518
+ ...["gemini-3.5-transcribe", "gemini-3.5-transcribe-live"].map((id) => [id, transcriptionEntry(id)])
519
+ ].reduce((catalog, [id, entry]) => {
520
+ const previous = catalog[id];
521
+ catalog[id] = {
522
+ capabilities: {
523
+ ...previous?.capabilities,
524
+ ...entry.capabilities
525
+ },
526
+ providerOptions: {
527
+ ...previous?.providerOptions,
528
+ ...entry.providerOptions
529
+ },
530
+ requestConfig: {
531
+ ...previous?.requestConfig,
532
+ ...entry.requestConfig
533
+ }
534
+ };
535
+ return catalog;
536
+ }, {});
537
+ Object.fromEntries(Object.entries({
538
+ "claude-fable-5-1": {
539
+ image: true,
540
+ objectGeneration: true,
541
+ tools: true,
542
+ streaming: true,
543
+ computerUse: true
544
+ },
545
+ "claude-3-7-sonnet@20250219": {
546
+ image: true,
547
+ objectGeneration: true,
548
+ tools: true,
549
+ streaming: true,
550
+ computerUse: true
551
+ },
552
+ "claude-3-5-sonnet-v2@20241022": {
553
+ image: true,
554
+ objectGeneration: true,
555
+ tools: true,
556
+ streaming: true,
557
+ computerUse: true
558
+ },
559
+ "claude-3-5-sonnet@20240620": {
560
+ image: true,
561
+ objectGeneration: true,
562
+ tools: true,
563
+ streaming: true,
564
+ computerUse: false
565
+ },
566
+ "claude-3-5-haiku@20241022": {
567
+ image: false,
568
+ objectGeneration: true,
569
+ tools: true,
570
+ streaming: true,
571
+ computerUse: false
572
+ },
573
+ "claude-3-sonnet@20240229": {
574
+ image: true,
575
+ objectGeneration: true,
576
+ tools: true,
577
+ streaming: true,
578
+ computerUse: false
579
+ },
580
+ "claude-3-haiku@20240307": {
581
+ image: true,
582
+ objectGeneration: true,
583
+ tools: true,
584
+ streaming: true,
585
+ computerUse: false
586
+ },
587
+ "claude-3-opus@20240229": {
588
+ image: true,
589
+ objectGeneration: true,
590
+ tools: true,
591
+ streaming: true,
592
+ computerUse: false
593
+ }
594
+ }).map(([id, support]) => {
595
+ return [id, { capabilities: { language: {
596
+ inputs: {
597
+ image: support.image,
598
+ audio: false
599
+ },
600
+ objectGeneration: support.objectGeneration,
601
+ tools: {
602
+ usage: support.tools,
603
+ streaming: support.streaming,
604
+ computerUse: support.computerUse
605
+ },
606
+ reasoning: { support: "unknown" },
607
+ sampling: {
608
+ temperature: "unknown",
609
+ topP: "unknown",
610
+ logprobs: false
611
+ }
612
+ } } }];
613
+ }));
614
+ Object.fromEntries(Object.entries({
615
+ "xai/grok-4.20-reasoning": { reasoning: true },
616
+ "xai/grok-4.20-non-reasoning": { reasoning: false },
617
+ "xai/grok-4.1-fast-reasoning": { reasoning: true },
618
+ "xai/grok-4.1-fast-non-reasoning": { reasoning: false }
619
+ }).map(([id, support]) => {
620
+ return [id, { capabilities: { language: {
621
+ inputs: {
622
+ image: "unknown",
623
+ audio: "unknown"
624
+ },
625
+ objectGeneration: "unknown",
626
+ tools: {
627
+ usage: "unknown",
628
+ streaming: "unknown"
629
+ },
630
+ reasoning: { support: support.reasoning },
631
+ sampling: {
632
+ temperature: "unknown",
633
+ topP: "unknown",
634
+ logprobs: "unknown"
635
+ }
636
+ } } }];
637
+ }));
638
+ Object.fromEntries(Object.entries({
639
+ "deepseek-ai/deepseek-r1-0528-maas": { publisher: "DeepSeek" },
640
+ "deepseek-ai/deepseek-v3.1-maas": { publisher: "DeepSeek" },
641
+ "deepseek-ai/deepseek-v3.2-maas": { publisher: "DeepSeek" },
642
+ "openai/gpt-oss-120b-maas": { publisher: "OpenAI" },
643
+ "openai/gpt-oss-20b-maas": { publisher: "OpenAI" },
644
+ "meta/llama-4-maverick-17b-128e-instruct-maas": { publisher: "Meta" },
645
+ "meta/llama-4-scout-17b-16e-instruct-maas": { publisher: "Meta" },
646
+ "minimax/minimax-m2-maas": { publisher: "MiniMax" },
647
+ "qwen/qwen3-coder-480b-a35b-instruct-maas": { publisher: "Qwen" },
648
+ "qwen/qwen3-next-80b-a3b-instruct-maas": { publisher: "Qwen" },
649
+ "qwen/qwen3-next-80b-a3b-thinking-maas": { publisher: "Qwen" },
650
+ "moonshotai/kimi-k2-thinking-maas": { publisher: "Moonshot" }
651
+ }).map(([id, support]) => {
652
+ return [id, {
653
+ capabilities: { language: {
654
+ inputs: {
655
+ image: "unknown",
656
+ audio: "unknown"
657
+ },
658
+ objectGeneration: "unknown",
659
+ tools: {
660
+ usage: "unknown",
661
+ streaming: "unknown"
662
+ },
663
+ reasoning: { support: "unknown" },
664
+ sampling: {
665
+ temperature: "unknown",
666
+ topP: "unknown",
667
+ logprobs: "unknown"
668
+ },
669
+ publisher: support.publisher
670
+ } },
671
+ requestConfig: getGoogleVertexRequestConfig(id)
672
+ }];
673
+ }));
674
+ //#endregion
675
+ //#region src/google-vertex-image-model.ts
186
676
  var GoogleVertexImageModel = class GoogleVertexImageModel {
187
677
  static [WORKFLOW_SERIALIZE](model) {
188
678
  return serializeModelOptions({
@@ -194,7 +684,7 @@ var GoogleVertexImageModel = class GoogleVertexImageModel {
194
684
  return new GoogleVertexImageModel(options.modelId, options.config);
195
685
  }
196
686
  get supportsFileInputs() {
197
- return googleVertexImageModelsWithFileInputSupport.has(this.modelId) ? true : void 0;
687
+ return getGoogleVertexImageModelEntry(this.modelId).capabilities.image?.fileInput === true ? true : void 0;
198
688
  }
199
689
  get supportsMaskInputs() {
200
690
  return this.supportsFileInputs === true ? false : void 0;
@@ -209,7 +699,7 @@ var GoogleVertexImageModel = class GoogleVertexImageModel {
209
699
  this.maxImagesPerCall = 1;
210
700
  }
211
701
  async doGenerate(options) {
212
- if (!this.modelId.startsWith("gemini-")) throw new Error("Google image models other than Gemini are no longer supported. Use a model ID that starts with `gemini-`.");
702
+ if (!getGoogleVertexRequestConfig(this.modelId).image?.gemini) throw new Error("Google image models other than Gemini are no longer supported. Use a model ID that starts with `gemini-`.");
213
703
  const { prompt, size, aspectRatio, seed, providerOptions, headers, abortSignal, files, mask } = options;
214
704
  const warnings = [];
215
705
  if (mask != null) throw new Error("Gemini image models do not support mask-based image editing.");
@@ -595,7 +1085,7 @@ const liveWebSocketPath = "google.cloud.aiplatform.v1.LlmBidiService/BidiGenerat
595
1085
  const defaultFinishGraceMs = 3e3;
596
1086
  /** Live transcription is only supported by `*-live` model variants. */
597
1087
  function isLiveTranscriptionModelId(modelId) {
598
- return modelId.includes("-live");
1088
+ return getGoogleVertexRequestConfig(modelId).transcription?.live === true;
599
1089
  }
600
1090
  /** Regional Vertex hostname (mirrors the provider's base-URL host rules). */
601
1091
  function vertexHost(location) {
@@ -648,7 +1138,22 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
648
1138
  });
649
1139
  const currentDate = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date();
650
1140
  const warnings = [];
651
- const audioTranscriptionConfig = buildAudioTranscriptionConfig(await this.parseOptions(options.providerOptions));
1141
+ const googleOptions = await this.parseOptions(options.providerOptions);
1142
+ const wantsWord = options.timestampGranularities?.includes("word");
1143
+ if (wantsWord && googleOptions?.wordTimestamp === false) warnings.push({
1144
+ type: "unsupported",
1145
+ feature: "timestampGranularities",
1146
+ details: "The provider wordTimestamp option is false and overrides the requested word timings."
1147
+ });
1148
+ if (options.timestampGranularities?.includes("segment")) warnings.push({
1149
+ type: "unsupported",
1150
+ feature: "timestampGranularities",
1151
+ details: "Vertex Gemini transcription returns word timings and does not provide separate caption segments."
1152
+ });
1153
+ const audioTranscriptionConfig = buildAudioTranscriptionConfig(googleOptions?.wordTimestamp == null && wantsWord ? {
1154
+ ...googleOptions,
1155
+ wordTimestamp: true
1156
+ } : googleOptions);
652
1157
  const requestBody = {
653
1158
  contents: [{
654
1159
  role: "user",
@@ -674,6 +1179,7 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
674
1179
  const text = plainText !== "" ? plainText : transcriptionText;
675
1180
  let language;
676
1181
  const segments = [];
1182
+ const words = [];
677
1183
  for (const part of parts) {
678
1184
  const transcription = part.audioTranscription;
679
1185
  if (transcription == null) continue;
@@ -682,16 +1188,23 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
682
1188
  const startSecond = parseOffsetSeconds(word.startOffset);
683
1189
  const endSecond = parseOffsetSeconds(word.endOffset);
684
1190
  if (word.word == null || startSecond == null || endSecond == null) continue;
685
- segments.push({
1191
+ const timing = {
686
1192
  text: word.word,
687
1193
  startSecond,
688
1194
  endSecond
689
- });
1195
+ };
1196
+ words.push(timing);
1197
+ segments.push({ ...timing });
690
1198
  }
691
1199
  }
1200
+ if (wantsWord && googleOptions?.wordTimestamp !== false && words.length === 0 && text.trim() !== "") warnings.push({
1201
+ type: "other",
1202
+ message: "The Vertex Gemini transcription response omitted the requested word timings."
1203
+ });
692
1204
  return {
693
1205
  text,
694
1206
  segments,
1207
+ ...words.length > 0 ? { words } : {},
695
1208
  language,
696
1209
  durationInSeconds: void 0,
697
1210
  warnings,
@@ -1077,7 +1590,7 @@ var GoogleVertexVideoModel = class {
1077
1590
  "3840x2160": "4k"
1078
1591
  }[options.resolution] || options.resolution;
1079
1592
  if (options.duration) parameters.durationSeconds = options.duration;
1080
- if (options.seed) parameters.seed = options.seed;
1593
+ if (options.seed != null) parameters.seed = options.seed;
1081
1594
  const generateAudio = options.generateAudio ?? googleVertexOptions?.generateAudio;
1082
1595
  if (generateAudio != null) parameters.generateAudio = generateAudio;
1083
1596
  if (googleVertexOptions != null) {
@@ -1238,9 +1751,8 @@ const googleVertexOperationSchema = lazySchema(() => zodSchema(z.object({
1238
1751
  //#endregion
1239
1752
  //#region src/google-vertex-provider-base.ts
1240
1753
  const EXPRESS_MODE_BASE_URL = "https://aiplatform.googleapis.com/v1/publishers/google";
1241
- const ENDPOINT_MODEL_PREFIX = "endpoints/";
1242
1754
  function isEndpointModelId(modelId) {
1243
- return modelId.startsWith(ENDPOINT_MODEL_PREFIX);
1755
+ return getGoogleVertexRequestConfig(modelId).language?.endpoint === true;
1244
1756
  }
1245
1757
  function createExpressModeFetch(apiKey, customFetch) {
1246
1758
  return async (url, init) => {
@@ -1338,7 +1850,7 @@ function createGoogleVertex$1(options = {}) {
1338
1850
  generateId: options.generateId ?? generateId
1339
1851
  });
1340
1852
  const createSpeechModel = (modelId) => {
1341
- if (modelId.startsWith("chirp")) {
1853
+ if (getGoogleVertexRequestConfig(modelId).speech?.api === "cloud-tts") {
1342
1854
  if (apiKey) throw new Error("Google Vertex Chirp speech models do not support Express Mode API keys. Use standard Google Cloud credentials instead.");
1343
1855
  const config = createConfig("speech");
1344
1856
  return new GoogleVertexCloudTTSSpeechModel(modelId, {
@@ -1352,7 +1864,7 @@ function createGoogleVertex$1(options = {}) {
1352
1864
  const createTranscriptionModel = (modelId) => {
1353
1865
  if (apiKey) throw new Error("Google Vertex transcription models do not support Express Mode API keys. Use standard Google Cloud credentials instead.");
1354
1866
  const config = createConfig("transcription");
1355
- if (modelId.startsWith("gemini")) return new GoogleVertexGeminiTranscriptionModel(modelId, {
1867
+ if (getGoogleVertexRequestConfig(modelId).transcription?.api === "gemini") return new GoogleVertexGeminiTranscriptionModel(modelId, {
1356
1868
  provider: config.provider,
1357
1869
  baseURL: loadBaseURL(),
1358
1870
  headers: config.headers,