@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.
- package/CHANGELOG.md +53 -0
- package/dist/anthropic/edge/index.d.ts +7 -0
- package/dist/anthropic/edge/index.d.ts.map +1 -1
- package/dist/anthropic/edge/index.js +6 -2
- package/dist/anthropic/edge/index.js.map +1 -1
- package/dist/anthropic/index.d.ts +7 -0
- package/dist/anthropic/index.d.ts.map +1 -1
- package/dist/anthropic/index.js +5 -1
- package/dist/anthropic/index.js.map +1 -1
- package/dist/edge/index.d.ts.map +1 -1
- package/dist/edge/index.js +529 -17
- package/dist/edge/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +529 -17
- package/dist/index.js.map +1 -1
- package/dist/maas/edge/index.d.ts.map +1 -1
- package/dist/maas/edge/index.js +26 -6
- package/dist/maas/edge/index.js.map +1 -1
- package/dist/maas/index.d.ts.map +1 -1
- package/dist/maas/index.js +25 -5
- package/dist/maas/index.js.map +1 -1
- package/dist/xai/edge/index.js +1 -1
- package/docs/16-google-vertex.mdx +256 -32
- package/package.json +6 -6
- package/src/anthropic/google-vertex-anthropic-provider.ts +22 -3
- package/src/gemini-transcription/google-vertex-gemini-transcription-model.ts +46 -3
- package/src/google-vertex-embedding-model.ts +2 -1
- package/src/google-vertex-image-model.ts +5 -9
- package/src/google-vertex-model-catalog-config.ts +42 -0
- package/src/google-vertex-model-catalog.ts +586 -0
- package/src/google-vertex-provider-base.ts +4 -5
- package/src/google-vertex-video-model.ts +1 -1
- package/src/maas/google-vertex-maas-provider.ts +3 -6
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["GoogleVertexProviderSettings","GoogleVertexProviderSettingsOriginal","TranscriptionModelV4StreamOptions"],"sources":["../src/google-vertex-embedding-model-options.ts","../src/google-vertex-transcription-model-options.ts","../src/google-vertex-image-model-options.ts","../src/google-vertex-video-model-options.ts","../src/google-vertex-video-settings.ts","../src/google-vertex-speech-model-options.ts","../src/google-vertex-config.ts","../src/google-vertex-embedding-model.ts","../src/google-vertex-image-settings.ts","../src/google-vertex-options.ts","../src/google-vertex-tools.ts","../src/google-vertex-provider-base.ts","../src/google-vertex-provider.ts","../src/gemini-transcription/google-vertex-gemini-transcription-model-options.ts","../src/gemini-transcription/google-vertex-gemini-transcription-model.ts","../src/version.ts"],"mappings":";;;;;;KAQY;cAcC,oEAAiC;;;;;;KAkDlC,oCAAoC,mBACvC;;;KChEG;cAMC,iFAA8C;;;;;;KAsC/C,wCAAwC,mBAC3C;;;KCpDG,gCAAgC,KAC1C;;;KCAU;EAEV;EACA;EAGA;EACA;EACA;EAGA;EAGA,kBAAkB;IAChB;IACA;;GAGD;;;;KCtBS;;;KCMA;KAQA,iCAAiC;;;UCZ5B;EACf;EACA;EACA,UAAU,WAAW;EACrB,QAAQ;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["GoogleVertexProviderSettings","GoogleVertexProviderSettingsOriginal","TranscriptionModelV4StreamOptions"],"sources":["../src/google-vertex-embedding-model-options.ts","../src/google-vertex-transcription-model-options.ts","../src/google-vertex-image-model-options.ts","../src/google-vertex-video-model-options.ts","../src/google-vertex-video-settings.ts","../src/google-vertex-speech-model-options.ts","../src/google-vertex-config.ts","../src/google-vertex-embedding-model.ts","../src/google-vertex-image-settings.ts","../src/google-vertex-options.ts","../src/google-vertex-tools.ts","../src/google-vertex-provider-base.ts","../src/google-vertex-provider.ts","../src/gemini-transcription/google-vertex-gemini-transcription-model-options.ts","../src/gemini-transcription/google-vertex-gemini-transcription-model.ts","../src/version.ts"],"mappings":";;;;;;KAQY;cAcC,oEAAiC;;;;;;KAkDlC,oCAAoC,mBACvC;;;KChEG;cAMC,iFAA8C;;;;;;KAsC/C,wCAAwC,mBAC3C;;;KCpDG,gCAAgC,KAC1C;;;KCAU;EAEV;EACA;EAGA;EACA;EACA;EAGA;EAGA,kBAAkB;IAChB;IACA;;GAGD;;;;KCtBS;;;KCMA;KAQA,iCAAiC;;;UCZ5B;EACf;EACA;EACA,UAAU,WAAW;EACrB,QAAQ;;;;cCmBG,sCAAsC;WACxC;WACA,SAAS;WACT;mBAEQ;UAET,oBAAoB,OAAO;;;;UAO3B,sBAAsB;IAC5B;IACA,QAAQ;MACT;MAIG;MAMA;EAKF,YAAA,SAAS,8BACT,QAAQ;EAMJ,UACJ,QACA,YACA,SACA,aACA,mBACC,WAAW,kCAAkC,QAC9C,QAAQ,WAAW;;;;KCvEX;;;KCGA;;;cCDC;;;;MAS87sB,YAAC;MAAsD,cAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UC0El/sB,6BAA6B;;;;GAI3C,SAAS,sBAAsB;EAEhC,gBAAgB,SAAS,wBAAwB;;;;;;;EAQjD,aACE,gBACI;IACE,OAAO;;IACP;MACL;;;;EAKH,MAAM,SAAS,2BAA2B;;;;EAK1C,WAAW,SAAS,2BAA2B;EAE/C,cAAc;;;;EAKd,mBACE,SAAS,+BACR;;;;EAKH,MAAM,SAAS,2BAA2B;;;;EAK1C,WAAW,SAAS,2BAA2B;;;;EAK/C,OAAO,SAAS,4BAA4B;;;;EAK5C,YAAY,SAAS,4BAA4B;;;;EAKjD,cACE,SAAS,mCACR;;;;EAKH,mBACE,SAAS,mCACR;;UAGYA;;;;;;;EAOf,SAAS;;;;EAKT;;;;EAKA;;;;;;;;EASA,UAAU,WAAW;;;;;EAMrB,QAAQ;EAGR;;;;EAKA;;;;;;EAOA,YAAY;;;;;EAMZ;;;;IAIE;;;;;UCjNa,qCAAqCC;;;;;;;EAOpD,oBAAoB;;wBAKN,mBACd,UAAS,+BACR;;;;qBAmCU,cAAY;;;KClDb;;;;;;;cAWC,8EAA2C;;;;;;;KAuC5C,8CAA8C,mBACjD;;;UCiCC;EACR;;EAEA;EACA,UAAU,WAAW;EACrB,QAAQ;EACR,YAAY;EACZ;EACA;EACA;IACE,oBAAoB;IACpB;;;;;;;;;qBAUS,gDAAgD;WAyBhD,SAAS;mBACD;WAzBV;UAED,oBAAoB,OAAO;;;;UAO3B,sBAAsB;IAC5B,SAAS;IACT,QAAQ;MACT;MAOG;EAKO,YAAA,SAAS,wCACD,QAAQ;UAGb;EAeR,WACJ,SAAS,WAAW,yCACnB,QAAQ,QAAQ,WAAW;EAkJxB,SACJ,SAASC,iDACR,QACD,QAAQ,WAAW,YAAY;;;;qBCjTtB"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, connectToWebSocket, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createJsonErrorResponseHandler, createJsonResponseHandler, generateId, isValidHostnamePart, lazySchema, loadOptionalSetting, loadSetting, normalizeHeaders, parseProviderOptions, postJsonToApi, resolve, safeParseJSON, serializeModelOptions, waitForWebSocketBufferDrain, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
2
2
|
import { GoogleAuth } from "google-auth-library";
|
|
3
|
-
import { GoogleInteractionsLanguageModel, GoogleLanguageModel, GoogleSpeechModel, googleTools } from "@ai-sdk/google/internal";
|
|
3
|
+
import { GoogleInteractionsLanguageModel, GoogleLanguageModel, GoogleSpeechModel, getGoogleLanguageModelEntry, googleProviderOptions, googleTools } from "@ai-sdk/google/internal";
|
|
4
4
|
import { AISDKError, InvalidArgumentError, LoadAPIKeyError, TooManyEmbeddingValuesForCallError } from "@ai-sdk/provider";
|
|
5
5
|
import { z } from "zod/v4";
|
|
6
6
|
//#region src/google-vertex-auth-google-auth-library.ts
|
|
@@ -14,8 +14,32 @@ function createAuthTokenGenerator(options) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
17
|
+
//#region src/google-vertex-model-catalog-config.ts
|
|
18
|
+
function requestConfig(modelId) {
|
|
19
|
+
const embedContent = modelId === "gemini-embedding-2" || modelId === "gemini-embedding-2-preview";
|
|
20
|
+
return {
|
|
21
|
+
language: {
|
|
22
|
+
endpoint: modelId.startsWith("endpoints/"),
|
|
23
|
+
maxOutputTokens: modelId === "meta/llama-4-maverick-17b-128e-instruct-maas" || modelId === "meta/llama-4-scout-17b-16e-instruct-maas" ? 8192 : void 0
|
|
24
|
+
},
|
|
25
|
+
image: { gemini: modelId.startsWith("gemini-") },
|
|
26
|
+
embedding: {
|
|
27
|
+
endpoint: embedContent ? "embedContent" : "predict",
|
|
28
|
+
maxEmbeddingsPerCall: embedContent ? 1 : 250
|
|
29
|
+
},
|
|
30
|
+
speech: { api: modelId.startsWith("chirp") ? "cloud-tts" : "gemini" },
|
|
31
|
+
transcription: {
|
|
32
|
+
api: modelId.startsWith("gemini") ? "gemini" : "cloud-speech",
|
|
33
|
+
live: modelId.includes("-live")
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function getGoogleVertexRequestConfig(modelId) {
|
|
38
|
+
return requestConfig(modelId);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
17
41
|
//#region src/version.ts
|
|
18
|
-
const VERSION = "5.0.
|
|
42
|
+
const VERSION = "5.0.133";
|
|
19
43
|
//#endregion
|
|
20
44
|
//#region src/google-vertex-error.ts
|
|
21
45
|
const googleVertexErrorDataSchema = lazySchema(() => zodSchema(z.object({ error: z.object({
|
|
@@ -185,16 +209,482 @@ const googleVertexEmbedContentResponseSchema = lazySchema(() => zodSchema(z.obje
|
|
|
185
209
|
usageMetadata: z.object({ promptTokenCount: z.number().nullish() }).nullish()
|
|
186
210
|
})));
|
|
187
211
|
function usesEmbedContentEndpoint(modelId) {
|
|
188
|
-
return modelId
|
|
212
|
+
return getGoogleVertexRequestConfig(modelId).embedding?.endpoint === "embedContent";
|
|
189
213
|
}
|
|
190
214
|
//#endregion
|
|
191
|
-
//#region src/google-vertex-
|
|
192
|
-
const
|
|
215
|
+
//#region src/google-vertex-model-catalog.ts
|
|
216
|
+
const documentedImageDetails = {
|
|
217
|
+
"gemini-nano-banana-2.1": {
|
|
218
|
+
imageGeneration: true,
|
|
219
|
+
aspectRatios: [
|
|
220
|
+
"1:1",
|
|
221
|
+
"2:3",
|
|
222
|
+
"3:2",
|
|
223
|
+
"3:4",
|
|
224
|
+
"4:3",
|
|
225
|
+
"4:5",
|
|
226
|
+
"5:4",
|
|
227
|
+
"9:16",
|
|
228
|
+
"16:9",
|
|
229
|
+
"21:9",
|
|
230
|
+
"1:8",
|
|
231
|
+
"8:1",
|
|
232
|
+
"1:4",
|
|
233
|
+
"4:1"
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
"gemini-3.1-flash-image-preview": {
|
|
237
|
+
imageGeneration: true,
|
|
238
|
+
aspectRatios: [
|
|
239
|
+
"1:1",
|
|
240
|
+
"2:3",
|
|
241
|
+
"3:2",
|
|
242
|
+
"3:4",
|
|
243
|
+
"4:3",
|
|
244
|
+
"4:5",
|
|
245
|
+
"5:4",
|
|
246
|
+
"9:16",
|
|
247
|
+
"16:9",
|
|
248
|
+
"21:9"
|
|
249
|
+
]
|
|
250
|
+
},
|
|
251
|
+
"gemini-3-pro-image-preview": {
|
|
252
|
+
imageGeneration: true,
|
|
253
|
+
aspectRatios: [
|
|
254
|
+
"1:1",
|
|
255
|
+
"2:3",
|
|
256
|
+
"3:2",
|
|
257
|
+
"3:4",
|
|
258
|
+
"4:3",
|
|
259
|
+
"4:5",
|
|
260
|
+
"5:4",
|
|
261
|
+
"9:16",
|
|
262
|
+
"16:9",
|
|
263
|
+
"21:9"
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
"gemini-2.5-flash-image": {
|
|
267
|
+
imageGeneration: true,
|
|
268
|
+
aspectRatios: [
|
|
269
|
+
"1:1",
|
|
270
|
+
"2:3",
|
|
271
|
+
"3:2",
|
|
272
|
+
"3:4",
|
|
273
|
+
"4:3",
|
|
274
|
+
"4:5",
|
|
275
|
+
"5:4",
|
|
276
|
+
"9:16",
|
|
277
|
+
"16:9",
|
|
278
|
+
"21:9"
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const documentedTranscriptionDetails = {
|
|
283
|
+
chirp_2: {
|
|
284
|
+
wordTimestampDescription: "Available with a potential quality and speed tradeoff",
|
|
285
|
+
languageDetectionDescription: "Auto detection with `['auto']`"
|
|
286
|
+
},
|
|
287
|
+
chirp_3: {
|
|
288
|
+
wordTimestampDescription: "Available with a potential transcription quality tradeoff",
|
|
289
|
+
languageDetectionDescription: "Auto detection with `['auto']`"
|
|
290
|
+
},
|
|
291
|
+
telephony: {
|
|
292
|
+
wordTimestampDescription: "Available",
|
|
293
|
+
languageDetectionDescription: "Explicit supported language codes, with alternative language detection support"
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
const googleVertexProviderOptions = {
|
|
297
|
+
language: googleProviderOptions.language,
|
|
298
|
+
image: Object.fromEntries(Object.entries(googleProviderOptions.language).filter(([key]) => key !== "responseModalities")),
|
|
299
|
+
embedding: {
|
|
300
|
+
outputDimensionality: { description: "Reduced output dimensions." },
|
|
301
|
+
taskType: { description: "Task for which embeddings are optimized." },
|
|
302
|
+
title: { description: "Document title; requires RETRIEVAL_DOCUMENT." },
|
|
303
|
+
autoTruncate: { description: "Truncate inputs exceeding the model context." }
|
|
304
|
+
},
|
|
305
|
+
speech: {
|
|
306
|
+
speechMetadata: { description: "Directions for Gemini 3.8 speech." },
|
|
307
|
+
turns: { description: "Structured transcript for Gemini 3.8 speech." },
|
|
308
|
+
multiSpeakerVoiceConfig: { description: "Voice configuration for dialogue speakers." }
|
|
309
|
+
},
|
|
310
|
+
transcription: {
|
|
311
|
+
languageCodes: { description: "Language hints or automatic language detection." },
|
|
312
|
+
enableAutomaticPunctuation: { description: "Include punctuation in Cloud Speech transcripts." },
|
|
313
|
+
enableWordTimeOffsets: { description: "Include Cloud Speech word timestamps." },
|
|
314
|
+
region: { description: "Cloud Speech region." },
|
|
315
|
+
customVocabulary: { description: "Vocabulary hints for Gemini transcription." },
|
|
316
|
+
wordTimestamp: { description: "Include Gemini word timestamps." },
|
|
317
|
+
diarization: { description: "Enable Gemini speaker diarization." },
|
|
318
|
+
mode: { description: "Verbatim or smart Gemini transcription formatting." }
|
|
319
|
+
},
|
|
320
|
+
video: {
|
|
321
|
+
pollIntervalMs: { description: "Polling interval." },
|
|
322
|
+
pollTimeoutMs: { description: "Polling timeout." },
|
|
323
|
+
personGeneration: { description: "Policy for generating people." },
|
|
324
|
+
negativePrompt: { description: "Content to avoid." },
|
|
325
|
+
generateAudio: { description: "Generate synchronized audio." },
|
|
326
|
+
gcsOutputDirectory: { description: "Cloud Storage output directory." },
|
|
327
|
+
referenceImages: { description: "Reference images for video generation." }
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
function languageEntry(modelId) {
|
|
331
|
+
const entry = getGoogleLanguageModelEntry(modelId);
|
|
332
|
+
return {
|
|
333
|
+
capabilities: { language: entry.capabilities.language },
|
|
334
|
+
providerOptions: { language: {
|
|
335
|
+
...entry.providerOptions.language,
|
|
336
|
+
serviceTier: false
|
|
337
|
+
} },
|
|
338
|
+
requestConfig: { language: getGoogleVertexRequestConfig(modelId).language }
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
const imageModels = [
|
|
193
342
|
"gemini-2.5-flash-image",
|
|
194
343
|
"gemini-3-pro-image-preview",
|
|
195
344
|
"gemini-3.1-flash-image-preview",
|
|
196
345
|
"gemini-nano-banana-2.1"
|
|
197
|
-
]
|
|
346
|
+
];
|
|
347
|
+
function getGoogleVertexImageModelEntry(modelId) {
|
|
348
|
+
const known = imageModels.includes(modelId);
|
|
349
|
+
return {
|
|
350
|
+
capabilities: { image: {
|
|
351
|
+
sizes: { description: "Use aspectRatio; the size option is unsupported." },
|
|
352
|
+
fileInput: known ? true : "unknown",
|
|
353
|
+
maskInput: known ? false : "unknown",
|
|
354
|
+
maxImagesPerCall: 1,
|
|
355
|
+
...documentedImageDetails[modelId]
|
|
356
|
+
} },
|
|
357
|
+
providerOptions: { image: Object.fromEntries(Object.keys(googleVertexProviderOptions.image).map((key) => [key, key === "serviceTier" ? false : { condition: "Support follows the Gemini language model and image configuration." }])) },
|
|
358
|
+
requestConfig: { image: getGoogleVertexRequestConfig(modelId).image }
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function embeddingEntry(modelId) {
|
|
362
|
+
return {
|
|
363
|
+
capabilities: { embedding: {
|
|
364
|
+
defaultDimensions: modelId.startsWith("gemini-embedding-") ? 3072 : 768,
|
|
365
|
+
customDimensions: "unknown",
|
|
366
|
+
maxEmbeddingsPerCall: getGoogleVertexRequestConfig(modelId).embedding.maxEmbeddingsPerCall,
|
|
367
|
+
supportsParallelCalls: true,
|
|
368
|
+
multimodal: getGoogleVertexRequestConfig(modelId).embedding.endpoint === "embedContent"
|
|
369
|
+
} },
|
|
370
|
+
providerOptions: { embedding: {
|
|
371
|
+
outputDimensionality: "unknown",
|
|
372
|
+
taskType: "unknown",
|
|
373
|
+
title: { condition: "Requires RETRIEVAL_DOCUMENT." },
|
|
374
|
+
autoTruncate: true
|
|
375
|
+
} },
|
|
376
|
+
requestConfig: { embedding: getGoogleVertexRequestConfig(modelId).embedding }
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function speechEntry(modelId) {
|
|
380
|
+
const chirp = getGoogleVertexRequestConfig(modelId).speech?.api === "cloud-tts";
|
|
381
|
+
return {
|
|
382
|
+
capabilities: { speech: {
|
|
383
|
+
instructions: !chirp,
|
|
384
|
+
multiSpeaker: !chirp
|
|
385
|
+
} },
|
|
386
|
+
providerOptions: { speech: {
|
|
387
|
+
multiSpeakerVoiceConfig: chirp ? false : true,
|
|
388
|
+
speechMetadata: chirp ? false : { condition: "Requires Gemini 3.8 TTS." },
|
|
389
|
+
turns: chirp ? false : { condition: "Requires Gemini 3.8 TTS." }
|
|
390
|
+
} },
|
|
391
|
+
requestConfig: { speech: getGoogleVertexRequestConfig(modelId).speech }
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function transcriptionEntry(modelId) {
|
|
395
|
+
const config = getGoogleVertexRequestConfig(modelId).transcription;
|
|
396
|
+
const gemini = config.api === "gemini";
|
|
397
|
+
return {
|
|
398
|
+
capabilities: { transcription: {
|
|
399
|
+
transcription: !config.live,
|
|
400
|
+
streaming: config.live,
|
|
401
|
+
duration: gemini ? false : true,
|
|
402
|
+
segments: config.live ? false : { condition: "Requires word timestamps." },
|
|
403
|
+
language: true,
|
|
404
|
+
...documentedTranscriptionDetails[modelId]
|
|
405
|
+
} },
|
|
406
|
+
providerOptions: { transcription: {
|
|
407
|
+
languageCodes: true,
|
|
408
|
+
enableAutomaticPunctuation: !gemini,
|
|
409
|
+
enableWordTimeOffsets: !gemini,
|
|
410
|
+
region: !gemini,
|
|
411
|
+
customVocabulary: gemini,
|
|
412
|
+
wordTimestamp: gemini,
|
|
413
|
+
diarization: gemini,
|
|
414
|
+
mode: gemini
|
|
415
|
+
} },
|
|
416
|
+
requestConfig: { transcription: config }
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function videoEntry(modelId) {
|
|
420
|
+
const veo3 = modelId.startsWith("veo-3");
|
|
421
|
+
return {
|
|
422
|
+
capabilities: { video: {
|
|
423
|
+
inputs: {
|
|
424
|
+
text: true,
|
|
425
|
+
image: true,
|
|
426
|
+
firstFrame: true,
|
|
427
|
+
lastFrame: { condition: "Requires a Veo model supporting frame interpolation." },
|
|
428
|
+
referenceImage: { condition: "Requires a Veo model supporting reference images." },
|
|
429
|
+
referenceVideo: false
|
|
430
|
+
},
|
|
431
|
+
generateAudio: veo3,
|
|
432
|
+
aspectRatio: true,
|
|
433
|
+
resolution: true,
|
|
434
|
+
duration: true,
|
|
435
|
+
fps: false,
|
|
436
|
+
seed: true,
|
|
437
|
+
maxVideosPerCall: 4
|
|
438
|
+
} },
|
|
439
|
+
providerOptions: { video: {
|
|
440
|
+
pollIntervalMs: true,
|
|
441
|
+
pollTimeoutMs: true,
|
|
442
|
+
personGeneration: true,
|
|
443
|
+
negativePrompt: true,
|
|
444
|
+
generateAudio: veo3,
|
|
445
|
+
gcsOutputDirectory: true,
|
|
446
|
+
referenceImages: { condition: "Requires a Veo model supporting reference images." }
|
|
447
|
+
} }
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
[
|
|
451
|
+
...[
|
|
452
|
+
"gemini-nano-banana-2.1",
|
|
453
|
+
"gemini-4-argon",
|
|
454
|
+
"gemini-3.8-flash",
|
|
455
|
+
"gemini-3.7-flash",
|
|
456
|
+
"gemini-3.6-flash",
|
|
457
|
+
"gemini-3.5-flash",
|
|
458
|
+
"gemini-3.5-flash-lite",
|
|
459
|
+
"gemini-2.5-pro",
|
|
460
|
+
"gemini-2.5-flash",
|
|
461
|
+
"gemini-2.5-flash-lite",
|
|
462
|
+
"gemini-2.0-flash-lite",
|
|
463
|
+
"gemini-2.0-flash",
|
|
464
|
+
"gemini-2.0-flash-001",
|
|
465
|
+
"gemini-1.5-flash",
|
|
466
|
+
"gemini-1.5-flash-001",
|
|
467
|
+
"gemini-1.5-flash-002",
|
|
468
|
+
"gemini-1.5-pro",
|
|
469
|
+
"gemini-1.5-pro-001",
|
|
470
|
+
"gemini-1.5-pro-002",
|
|
471
|
+
"gemini-1.0-pro-001",
|
|
472
|
+
"gemini-1.0-pro-vision-001",
|
|
473
|
+
"gemini-1.0-pro",
|
|
474
|
+
"gemini-1.0-pro-002",
|
|
475
|
+
"gemini-2.0-flash-lite-preview-02-05",
|
|
476
|
+
"gemini-2.5-flash-preview-09-2025",
|
|
477
|
+
"gemini-3-pro-preview",
|
|
478
|
+
"gemini-3-pro-image-preview",
|
|
479
|
+
"gemini-3-flash-preview",
|
|
480
|
+
"gemini-3.1-pro-preview",
|
|
481
|
+
"gemini-3.1-flash-image-preview",
|
|
482
|
+
"gemini-3.1-flash-lite-preview",
|
|
483
|
+
"gemini-2.0-pro-exp-02-05",
|
|
484
|
+
"gemini-2.0-flash-exp"
|
|
485
|
+
].map((id) => [id, languageEntry(id)]),
|
|
486
|
+
...[
|
|
487
|
+
"gemini-2.5-flash-image",
|
|
488
|
+
"gemini-3-pro-image-preview",
|
|
489
|
+
"gemini-3.1-flash-image-preview",
|
|
490
|
+
"gemini-nano-banana-2.1"
|
|
491
|
+
].map((id) => [id, getGoogleVertexImageModelEntry(id)]),
|
|
492
|
+
...[
|
|
493
|
+
"textembedding-gecko",
|
|
494
|
+
"textembedding-gecko@001",
|
|
495
|
+
"textembedding-gecko@003",
|
|
496
|
+
"textembedding-gecko-multilingual",
|
|
497
|
+
"textembedding-gecko-multilingual@001",
|
|
498
|
+
"text-multilingual-embedding-002",
|
|
499
|
+
"text-embedding-004",
|
|
500
|
+
"text-embedding-005",
|
|
501
|
+
"gemini-embedding-001",
|
|
502
|
+
"gemini-embedding-2",
|
|
503
|
+
"gemini-embedding-2-preview"
|
|
504
|
+
].map((id) => [id, embeddingEntry(id)]),
|
|
505
|
+
...[
|
|
506
|
+
"veo-2.0-generate-preview",
|
|
507
|
+
"veo-2.0-generate-exp",
|
|
508
|
+
"veo-2.0-generate-001",
|
|
509
|
+
"veo-3.0-generate-001",
|
|
510
|
+
"veo-3.0-fast-generate-001",
|
|
511
|
+
"veo-3.0-generate-preview",
|
|
512
|
+
"veo-3.0-fast-generate-preview",
|
|
513
|
+
"veo-3.1-generate-001",
|
|
514
|
+
"veo-3.1-fast-generate-001",
|
|
515
|
+
"veo-3.1-generate-preview",
|
|
516
|
+
"veo-3.1-fast-generate-preview"
|
|
517
|
+
].map((id) => [id, videoEntry(id)]),
|
|
518
|
+
...[
|
|
519
|
+
"gemini-2.5-flash-tts",
|
|
520
|
+
"gemini-2.5-pro-tts",
|
|
521
|
+
"gemini-2.5-flash-lite-preview-tts",
|
|
522
|
+
"gemini-3.1-flash-tts-preview",
|
|
523
|
+
"chirp-3-hd"
|
|
524
|
+
].map((id) => [id, speechEntry(id)]),
|
|
525
|
+
...[
|
|
526
|
+
"chirp_2",
|
|
527
|
+
"chirp_3",
|
|
528
|
+
"telephony"
|
|
529
|
+
].map((id) => [id, transcriptionEntry(id)]),
|
|
530
|
+
...["gemini-3.5-transcribe", "gemini-3.5-transcribe-live"].map((id) => [id, transcriptionEntry(id)])
|
|
531
|
+
].reduce((catalog, [id, entry]) => {
|
|
532
|
+
const previous = catalog[id];
|
|
533
|
+
catalog[id] = {
|
|
534
|
+
capabilities: {
|
|
535
|
+
...previous?.capabilities,
|
|
536
|
+
...entry.capabilities
|
|
537
|
+
},
|
|
538
|
+
providerOptions: {
|
|
539
|
+
...previous?.providerOptions,
|
|
540
|
+
...entry.providerOptions
|
|
541
|
+
},
|
|
542
|
+
requestConfig: {
|
|
543
|
+
...previous?.requestConfig,
|
|
544
|
+
...entry.requestConfig
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
return catalog;
|
|
548
|
+
}, {});
|
|
549
|
+
Object.fromEntries(Object.entries({
|
|
550
|
+
"claude-fable-5-1": {
|
|
551
|
+
image: true,
|
|
552
|
+
objectGeneration: true,
|
|
553
|
+
tools: true,
|
|
554
|
+
streaming: true,
|
|
555
|
+
computerUse: true
|
|
556
|
+
},
|
|
557
|
+
"claude-3-7-sonnet@20250219": {
|
|
558
|
+
image: true,
|
|
559
|
+
objectGeneration: true,
|
|
560
|
+
tools: true,
|
|
561
|
+
streaming: true,
|
|
562
|
+
computerUse: true
|
|
563
|
+
},
|
|
564
|
+
"claude-3-5-sonnet-v2@20241022": {
|
|
565
|
+
image: true,
|
|
566
|
+
objectGeneration: true,
|
|
567
|
+
tools: true,
|
|
568
|
+
streaming: true,
|
|
569
|
+
computerUse: true
|
|
570
|
+
},
|
|
571
|
+
"claude-3-5-sonnet@20240620": {
|
|
572
|
+
image: true,
|
|
573
|
+
objectGeneration: true,
|
|
574
|
+
tools: true,
|
|
575
|
+
streaming: true,
|
|
576
|
+
computerUse: false
|
|
577
|
+
},
|
|
578
|
+
"claude-3-5-haiku@20241022": {
|
|
579
|
+
image: false,
|
|
580
|
+
objectGeneration: true,
|
|
581
|
+
tools: true,
|
|
582
|
+
streaming: true,
|
|
583
|
+
computerUse: false
|
|
584
|
+
},
|
|
585
|
+
"claude-3-sonnet@20240229": {
|
|
586
|
+
image: true,
|
|
587
|
+
objectGeneration: true,
|
|
588
|
+
tools: true,
|
|
589
|
+
streaming: true,
|
|
590
|
+
computerUse: false
|
|
591
|
+
},
|
|
592
|
+
"claude-3-haiku@20240307": {
|
|
593
|
+
image: true,
|
|
594
|
+
objectGeneration: true,
|
|
595
|
+
tools: true,
|
|
596
|
+
streaming: true,
|
|
597
|
+
computerUse: false
|
|
598
|
+
},
|
|
599
|
+
"claude-3-opus@20240229": {
|
|
600
|
+
image: true,
|
|
601
|
+
objectGeneration: true,
|
|
602
|
+
tools: true,
|
|
603
|
+
streaming: true,
|
|
604
|
+
computerUse: false
|
|
605
|
+
}
|
|
606
|
+
}).map(([id, support]) => {
|
|
607
|
+
return [id, { capabilities: { language: {
|
|
608
|
+
inputs: {
|
|
609
|
+
image: support.image,
|
|
610
|
+
audio: false
|
|
611
|
+
},
|
|
612
|
+
objectGeneration: support.objectGeneration,
|
|
613
|
+
tools: {
|
|
614
|
+
usage: support.tools,
|
|
615
|
+
streaming: support.streaming,
|
|
616
|
+
computerUse: support.computerUse
|
|
617
|
+
},
|
|
618
|
+
reasoning: { support: "unknown" },
|
|
619
|
+
sampling: {
|
|
620
|
+
temperature: "unknown",
|
|
621
|
+
topP: "unknown",
|
|
622
|
+
logprobs: false
|
|
623
|
+
}
|
|
624
|
+
} } }];
|
|
625
|
+
}));
|
|
626
|
+
Object.fromEntries(Object.entries({
|
|
627
|
+
"xai/grok-4.20-reasoning": { reasoning: true },
|
|
628
|
+
"xai/grok-4.20-non-reasoning": { reasoning: false },
|
|
629
|
+
"xai/grok-4.1-fast-reasoning": { reasoning: true },
|
|
630
|
+
"xai/grok-4.1-fast-non-reasoning": { reasoning: false }
|
|
631
|
+
}).map(([id, support]) => {
|
|
632
|
+
return [id, { capabilities: { language: {
|
|
633
|
+
inputs: {
|
|
634
|
+
image: "unknown",
|
|
635
|
+
audio: "unknown"
|
|
636
|
+
},
|
|
637
|
+
objectGeneration: "unknown",
|
|
638
|
+
tools: {
|
|
639
|
+
usage: "unknown",
|
|
640
|
+
streaming: "unknown"
|
|
641
|
+
},
|
|
642
|
+
reasoning: { support: support.reasoning },
|
|
643
|
+
sampling: {
|
|
644
|
+
temperature: "unknown",
|
|
645
|
+
topP: "unknown",
|
|
646
|
+
logprobs: "unknown"
|
|
647
|
+
}
|
|
648
|
+
} } }];
|
|
649
|
+
}));
|
|
650
|
+
Object.fromEntries(Object.entries({
|
|
651
|
+
"deepseek-ai/deepseek-r1-0528-maas": { publisher: "DeepSeek" },
|
|
652
|
+
"deepseek-ai/deepseek-v3.1-maas": { publisher: "DeepSeek" },
|
|
653
|
+
"deepseek-ai/deepseek-v3.2-maas": { publisher: "DeepSeek" },
|
|
654
|
+
"openai/gpt-oss-120b-maas": { publisher: "OpenAI" },
|
|
655
|
+
"openai/gpt-oss-20b-maas": { publisher: "OpenAI" },
|
|
656
|
+
"meta/llama-4-maverick-17b-128e-instruct-maas": { publisher: "Meta" },
|
|
657
|
+
"meta/llama-4-scout-17b-16e-instruct-maas": { publisher: "Meta" },
|
|
658
|
+
"minimax/minimax-m2-maas": { publisher: "MiniMax" },
|
|
659
|
+
"qwen/qwen3-coder-480b-a35b-instruct-maas": { publisher: "Qwen" },
|
|
660
|
+
"qwen/qwen3-next-80b-a3b-instruct-maas": { publisher: "Qwen" },
|
|
661
|
+
"qwen/qwen3-next-80b-a3b-thinking-maas": { publisher: "Qwen" },
|
|
662
|
+
"moonshotai/kimi-k2-thinking-maas": { publisher: "Moonshot" }
|
|
663
|
+
}).map(([id, support]) => {
|
|
664
|
+
return [id, {
|
|
665
|
+
capabilities: { language: {
|
|
666
|
+
inputs: {
|
|
667
|
+
image: "unknown",
|
|
668
|
+
audio: "unknown"
|
|
669
|
+
},
|
|
670
|
+
objectGeneration: "unknown",
|
|
671
|
+
tools: {
|
|
672
|
+
usage: "unknown",
|
|
673
|
+
streaming: "unknown"
|
|
674
|
+
},
|
|
675
|
+
reasoning: { support: "unknown" },
|
|
676
|
+
sampling: {
|
|
677
|
+
temperature: "unknown",
|
|
678
|
+
topP: "unknown",
|
|
679
|
+
logprobs: "unknown"
|
|
680
|
+
},
|
|
681
|
+
publisher: support.publisher
|
|
682
|
+
} },
|
|
683
|
+
requestConfig: getGoogleVertexRequestConfig(id)
|
|
684
|
+
}];
|
|
685
|
+
}));
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/google-vertex-image-model.ts
|
|
198
688
|
var GoogleVertexImageModel = class GoogleVertexImageModel {
|
|
199
689
|
static [WORKFLOW_SERIALIZE](model) {
|
|
200
690
|
return serializeModelOptions({
|
|
@@ -206,7 +696,7 @@ var GoogleVertexImageModel = class GoogleVertexImageModel {
|
|
|
206
696
|
return new GoogleVertexImageModel(options.modelId, options.config);
|
|
207
697
|
}
|
|
208
698
|
get supportsFileInputs() {
|
|
209
|
-
return
|
|
699
|
+
return getGoogleVertexImageModelEntry(this.modelId).capabilities.image?.fileInput === true ? true : void 0;
|
|
210
700
|
}
|
|
211
701
|
get supportsMaskInputs() {
|
|
212
702
|
return this.supportsFileInputs === true ? false : void 0;
|
|
@@ -221,7 +711,7 @@ var GoogleVertexImageModel = class GoogleVertexImageModel {
|
|
|
221
711
|
this.maxImagesPerCall = 1;
|
|
222
712
|
}
|
|
223
713
|
async doGenerate(options) {
|
|
224
|
-
if (!this.modelId.
|
|
714
|
+
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-`.");
|
|
225
715
|
const { prompt, size, aspectRatio, seed, providerOptions, headers, abortSignal, files, mask } = options;
|
|
226
716
|
const warnings = [];
|
|
227
717
|
if (mask != null) throw new Error("Gemini image models do not support mask-based image editing.");
|
|
@@ -607,7 +1097,7 @@ const liveWebSocketPath = "google.cloud.aiplatform.v1.LlmBidiService/BidiGenerat
|
|
|
607
1097
|
const defaultFinishGraceMs = 3e3;
|
|
608
1098
|
/** Live transcription is only supported by `*-live` model variants. */
|
|
609
1099
|
function isLiveTranscriptionModelId(modelId) {
|
|
610
|
-
return modelId.
|
|
1100
|
+
return getGoogleVertexRequestConfig(modelId).transcription?.live === true;
|
|
611
1101
|
}
|
|
612
1102
|
/** Regional Vertex hostname (mirrors the provider's base-URL host rules). */
|
|
613
1103
|
function vertexHost(location) {
|
|
@@ -660,7 +1150,22 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
|
|
|
660
1150
|
});
|
|
661
1151
|
const currentDate = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date();
|
|
662
1152
|
const warnings = [];
|
|
663
|
-
const
|
|
1153
|
+
const googleOptions = await this.parseOptions(options.providerOptions);
|
|
1154
|
+
const wantsWord = options.timestampGranularities?.includes("word");
|
|
1155
|
+
if (wantsWord && googleOptions?.wordTimestamp === false) warnings.push({
|
|
1156
|
+
type: "unsupported",
|
|
1157
|
+
feature: "timestampGranularities",
|
|
1158
|
+
details: "The provider wordTimestamp option is false and overrides the requested word timings."
|
|
1159
|
+
});
|
|
1160
|
+
if (options.timestampGranularities?.includes("segment")) warnings.push({
|
|
1161
|
+
type: "unsupported",
|
|
1162
|
+
feature: "timestampGranularities",
|
|
1163
|
+
details: "Vertex Gemini transcription returns word timings and does not provide separate caption segments."
|
|
1164
|
+
});
|
|
1165
|
+
const audioTranscriptionConfig = buildAudioTranscriptionConfig(googleOptions?.wordTimestamp == null && wantsWord ? {
|
|
1166
|
+
...googleOptions,
|
|
1167
|
+
wordTimestamp: true
|
|
1168
|
+
} : googleOptions);
|
|
664
1169
|
const requestBody = {
|
|
665
1170
|
contents: [{
|
|
666
1171
|
role: "user",
|
|
@@ -686,6 +1191,7 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
|
|
|
686
1191
|
const text = plainText !== "" ? plainText : transcriptionText;
|
|
687
1192
|
let language;
|
|
688
1193
|
const segments = [];
|
|
1194
|
+
const words = [];
|
|
689
1195
|
for (const part of parts) {
|
|
690
1196
|
const transcription = part.audioTranscription;
|
|
691
1197
|
if (transcription == null) continue;
|
|
@@ -694,16 +1200,23 @@ var GoogleVertexGeminiTranscriptionModel = class GoogleVertexGeminiTranscription
|
|
|
694
1200
|
const startSecond = parseOffsetSeconds(word.startOffset);
|
|
695
1201
|
const endSecond = parseOffsetSeconds(word.endOffset);
|
|
696
1202
|
if (word.word == null || startSecond == null || endSecond == null) continue;
|
|
697
|
-
|
|
1203
|
+
const timing = {
|
|
698
1204
|
text: word.word,
|
|
699
1205
|
startSecond,
|
|
700
1206
|
endSecond
|
|
701
|
-
}
|
|
1207
|
+
};
|
|
1208
|
+
words.push(timing);
|
|
1209
|
+
segments.push({ ...timing });
|
|
702
1210
|
}
|
|
703
1211
|
}
|
|
1212
|
+
if (wantsWord && googleOptions?.wordTimestamp !== false && words.length === 0 && text.trim() !== "") warnings.push({
|
|
1213
|
+
type: "other",
|
|
1214
|
+
message: "The Vertex Gemini transcription response omitted the requested word timings."
|
|
1215
|
+
});
|
|
704
1216
|
return {
|
|
705
1217
|
text,
|
|
706
1218
|
segments,
|
|
1219
|
+
...words.length > 0 ? { words } : {},
|
|
707
1220
|
language,
|
|
708
1221
|
durationInSeconds: void 0,
|
|
709
1222
|
warnings,
|
|
@@ -1089,7 +1602,7 @@ var GoogleVertexVideoModel = class {
|
|
|
1089
1602
|
"3840x2160": "4k"
|
|
1090
1603
|
}[options.resolution] || options.resolution;
|
|
1091
1604
|
if (options.duration) parameters.durationSeconds = options.duration;
|
|
1092
|
-
if (options.seed) parameters.seed = options.seed;
|
|
1605
|
+
if (options.seed != null) parameters.seed = options.seed;
|
|
1093
1606
|
const generateAudio = options.generateAudio ?? googleVertexOptions?.generateAudio;
|
|
1094
1607
|
if (generateAudio != null) parameters.generateAudio = generateAudio;
|
|
1095
1608
|
if (googleVertexOptions != null) {
|
|
@@ -1250,9 +1763,8 @@ const googleVertexOperationSchema = lazySchema(() => zodSchema(z.object({
|
|
|
1250
1763
|
//#endregion
|
|
1251
1764
|
//#region src/google-vertex-provider-base.ts
|
|
1252
1765
|
const EXPRESS_MODE_BASE_URL = "https://aiplatform.googleapis.com/v1/publishers/google";
|
|
1253
|
-
const ENDPOINT_MODEL_PREFIX = "endpoints/";
|
|
1254
1766
|
function isEndpointModelId(modelId) {
|
|
1255
|
-
return modelId.
|
|
1767
|
+
return getGoogleVertexRequestConfig(modelId).language?.endpoint === true;
|
|
1256
1768
|
}
|
|
1257
1769
|
function createExpressModeFetch(apiKey, customFetch) {
|
|
1258
1770
|
return async (url, init) => {
|
|
@@ -1350,7 +1862,7 @@ function createGoogleVertex$1(options = {}) {
|
|
|
1350
1862
|
generateId: options.generateId ?? generateId
|
|
1351
1863
|
});
|
|
1352
1864
|
const createSpeechModel = (modelId) => {
|
|
1353
|
-
if (modelId.
|
|
1865
|
+
if (getGoogleVertexRequestConfig(modelId).speech?.api === "cloud-tts") {
|
|
1354
1866
|
if (apiKey) throw new Error("Google Vertex Chirp speech models do not support Express Mode API keys. Use standard Google Cloud credentials instead.");
|
|
1355
1867
|
const config = createConfig("speech");
|
|
1356
1868
|
return new GoogleVertexCloudTTSSpeechModel(modelId, {
|
|
@@ -1364,7 +1876,7 @@ function createGoogleVertex$1(options = {}) {
|
|
|
1364
1876
|
const createTranscriptionModel = (modelId) => {
|
|
1365
1877
|
if (apiKey) throw new Error("Google Vertex transcription models do not support Express Mode API keys. Use standard Google Cloud credentials instead.");
|
|
1366
1878
|
const config = createConfig("transcription");
|
|
1367
|
-
if (modelId.
|
|
1879
|
+
if (getGoogleVertexRequestConfig(modelId).transcription?.api === "gemini") return new GoogleVertexGeminiTranscriptionModel(modelId, {
|
|
1368
1880
|
provider: config.provider,
|
|
1369
1881
|
baseURL: loadBaseURL(),
|
|
1370
1882
|
headers: config.headers,
|