@ai-sdk/google-vertex 5.0.132 → 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 +16 -0
- package/dist/anthropic/edge/index.js +1 -1
- package/dist/edge/index.d.ts.map +1 -1
- package/dist/edge/index.js +502 -13
- package/dist/edge/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +502 -13
- 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 +167 -32
- package/package.json +4 -4
- package/src/gemini-transcription/google-vertex-gemini-transcription-model.ts +2 -1
- 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/maas/google-vertex-maas-provider.ts +3 -6
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getGoogleVertexRequestConfig } from './google-vertex-model-catalog-config';
|
|
2
|
+
import { getGoogleVertexImageModelEntry } from './google-vertex-model-catalog';
|
|
1
3
|
import type { GoogleLanguageModelOptions } from '@ai-sdk/google';
|
|
2
4
|
import { GoogleLanguageModel } from '@ai-sdk/google/internal';
|
|
3
5
|
import type {
|
|
@@ -26,13 +28,6 @@ interface GoogleVertexImageModelConfig {
|
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
const googleVertexImageModelsWithFileInputSupport = new Set<string>([
|
|
30
|
-
'gemini-2.5-flash-image',
|
|
31
|
-
'gemini-3-pro-image-preview',
|
|
32
|
-
'gemini-3.1-flash-image-preview',
|
|
33
|
-
'gemini-nano-banana-2.1',
|
|
34
|
-
]);
|
|
35
|
-
|
|
36
31
|
export class GoogleVertexImageModel implements ImageModelV4 {
|
|
37
32
|
readonly specificationVersion = 'v4';
|
|
38
33
|
|
|
@@ -53,7 +48,8 @@ export class GoogleVertexImageModel implements ImageModelV4 {
|
|
|
53
48
|
readonly maxImagesPerCall = 1;
|
|
54
49
|
|
|
55
50
|
get supportsFileInputs(): boolean | undefined {
|
|
56
|
-
return
|
|
51
|
+
return getGoogleVertexImageModelEntry(this.modelId).capabilities.image
|
|
52
|
+
?.fileInput === true
|
|
57
53
|
? true
|
|
58
54
|
: undefined;
|
|
59
55
|
}
|
|
@@ -74,7 +70,7 @@ export class GoogleVertexImageModel implements ImageModelV4 {
|
|
|
74
70
|
async doGenerate(
|
|
75
71
|
options: Parameters<ImageModelV4['doGenerate']>[0],
|
|
76
72
|
): Promise<Awaited<ReturnType<ImageModelV4['doGenerate']>>> {
|
|
77
|
-
if (!this.modelId.
|
|
73
|
+
if (!getGoogleVertexRequestConfig(this.modelId).image?.gemini) {
|
|
78
74
|
throw new Error(
|
|
79
75
|
'Google image models other than Gemini are no longer supported. Use a model ID that starts with `gemini-`.',
|
|
80
76
|
);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type VertexRequestConfig = {
|
|
2
|
+
language?: { endpoint: boolean; maxOutputTokens?: number };
|
|
3
|
+
image?: { gemini: boolean };
|
|
4
|
+
embedding?: {
|
|
5
|
+
endpoint: 'embedContent' | 'predict';
|
|
6
|
+
maxEmbeddingsPerCall: number;
|
|
7
|
+
};
|
|
8
|
+
speech?: { api: 'cloud-tts' | 'gemini' };
|
|
9
|
+
transcription?: { api: 'gemini' | 'cloud-speech'; live: boolean };
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function requestConfig(modelId: string): VertexRequestConfig {
|
|
13
|
+
const embedContent =
|
|
14
|
+
modelId === 'gemini-embedding-2' ||
|
|
15
|
+
modelId === 'gemini-embedding-2-preview';
|
|
16
|
+
return {
|
|
17
|
+
language: {
|
|
18
|
+
endpoint: modelId.startsWith('endpoints/'),
|
|
19
|
+
maxOutputTokens:
|
|
20
|
+
modelId === 'meta/llama-4-maverick-17b-128e-instruct-maas' ||
|
|
21
|
+
modelId === 'meta/llama-4-scout-17b-16e-instruct-maas'
|
|
22
|
+
? 8192
|
|
23
|
+
: undefined,
|
|
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
|
+
|
|
38
|
+
export function getGoogleVertexRequestConfig(
|
|
39
|
+
modelId: string,
|
|
40
|
+
): VertexRequestConfig {
|
|
41
|
+
return requestConfig(modelId);
|
|
42
|
+
}
|
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getGoogleVertexRequestConfig as requestConfig,
|
|
3
|
+
type VertexRequestConfig,
|
|
4
|
+
} from './google-vertex-model-catalog-config';
|
|
5
|
+
import type {
|
|
6
|
+
ModelEntry,
|
|
7
|
+
ProviderOptionDefinition,
|
|
8
|
+
ProviderOptionDefinitions,
|
|
9
|
+
} from '@ai-sdk/provider';
|
|
10
|
+
import {
|
|
11
|
+
getGoogleLanguageModelEntry,
|
|
12
|
+
googleProviderOptions,
|
|
13
|
+
} from '@ai-sdk/google/internal';
|
|
14
|
+
import type { GoogleVertexEmbeddingModelOptions } from './google-vertex-embedding-model-options';
|
|
15
|
+
import type { GoogleVertexTranscriptionModelOptions } from './google-vertex-transcription-model-options';
|
|
16
|
+
import type { GoogleVertexTranscriptionModelGeminiOptions } from './gemini-transcription/google-vertex-gemini-transcription-model-options';
|
|
17
|
+
import type { GoogleVertexSpeechModelOptions } from './google-vertex-speech-model-options';
|
|
18
|
+
const documentedImageDetails: Record<
|
|
19
|
+
string,
|
|
20
|
+
{ imageGeneration: boolean; aspectRatios: readonly string[] }
|
|
21
|
+
> = {
|
|
22
|
+
'gemini-nano-banana-2.1': {
|
|
23
|
+
imageGeneration: true,
|
|
24
|
+
aspectRatios: [
|
|
25
|
+
'1:1',
|
|
26
|
+
'2:3',
|
|
27
|
+
'3:2',
|
|
28
|
+
'3:4',
|
|
29
|
+
'4:3',
|
|
30
|
+
'4:5',
|
|
31
|
+
'5:4',
|
|
32
|
+
'9:16',
|
|
33
|
+
'16:9',
|
|
34
|
+
'21:9',
|
|
35
|
+
'1:8',
|
|
36
|
+
'8:1',
|
|
37
|
+
'1:4',
|
|
38
|
+
'4:1',
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
'gemini-3.1-flash-image-preview': {
|
|
42
|
+
imageGeneration: true,
|
|
43
|
+
aspectRatios: [
|
|
44
|
+
'1:1',
|
|
45
|
+
'2:3',
|
|
46
|
+
'3:2',
|
|
47
|
+
'3:4',
|
|
48
|
+
'4:3',
|
|
49
|
+
'4:5',
|
|
50
|
+
'5:4',
|
|
51
|
+
'9:16',
|
|
52
|
+
'16:9',
|
|
53
|
+
'21:9',
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
'gemini-3-pro-image-preview': {
|
|
57
|
+
imageGeneration: true,
|
|
58
|
+
aspectRatios: [
|
|
59
|
+
'1:1',
|
|
60
|
+
'2:3',
|
|
61
|
+
'3:2',
|
|
62
|
+
'3:4',
|
|
63
|
+
'4:3',
|
|
64
|
+
'4:5',
|
|
65
|
+
'5:4',
|
|
66
|
+
'9:16',
|
|
67
|
+
'16:9',
|
|
68
|
+
'21:9',
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
'gemini-2.5-flash-image': {
|
|
72
|
+
imageGeneration: true,
|
|
73
|
+
aspectRatios: [
|
|
74
|
+
'1:1',
|
|
75
|
+
'2:3',
|
|
76
|
+
'3:2',
|
|
77
|
+
'3:4',
|
|
78
|
+
'4:3',
|
|
79
|
+
'4:5',
|
|
80
|
+
'5:4',
|
|
81
|
+
'9:16',
|
|
82
|
+
'16:9',
|
|
83
|
+
'21:9',
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
const documentedTranscriptionDetails: Record<
|
|
88
|
+
string,
|
|
89
|
+
{ wordTimestampDescription: string; languageDetectionDescription: string }
|
|
90
|
+
> = {
|
|
91
|
+
chirp_2: {
|
|
92
|
+
wordTimestampDescription:
|
|
93
|
+
'Available with a potential quality and speed tradeoff',
|
|
94
|
+
languageDetectionDescription: "Auto detection with `['auto']`",
|
|
95
|
+
},
|
|
96
|
+
chirp_3: {
|
|
97
|
+
wordTimestampDescription:
|
|
98
|
+
'Available with a potential transcription quality tradeoff',
|
|
99
|
+
languageDetectionDescription: "Auto detection with `['auto']`",
|
|
100
|
+
},
|
|
101
|
+
telephony: {
|
|
102
|
+
wordTimestampDescription: 'Available',
|
|
103
|
+
languageDetectionDescription:
|
|
104
|
+
'Explicit supported language codes, with alternative language detection support',
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const googleVertexProviderOptions = {
|
|
109
|
+
language: googleProviderOptions.language,
|
|
110
|
+
image: Object.fromEntries(
|
|
111
|
+
Object.entries(googleProviderOptions.language).filter(
|
|
112
|
+
([key]) => key !== 'responseModalities',
|
|
113
|
+
),
|
|
114
|
+
),
|
|
115
|
+
embedding: {
|
|
116
|
+
outputDimensionality: { description: 'Reduced output dimensions.' },
|
|
117
|
+
taskType: { description: 'Task for which embeddings are optimized.' },
|
|
118
|
+
title: { description: 'Document title; requires RETRIEVAL_DOCUMENT.' },
|
|
119
|
+
autoTruncate: {
|
|
120
|
+
description: 'Truncate inputs exceeding the model context.',
|
|
121
|
+
},
|
|
122
|
+
} satisfies Record<
|
|
123
|
+
keyof GoogleVertexEmbeddingModelOptions,
|
|
124
|
+
ProviderOptionDefinition
|
|
125
|
+
>,
|
|
126
|
+
speech: {
|
|
127
|
+
speechMetadata: { description: 'Directions for Gemini 3.8 speech.' },
|
|
128
|
+
turns: { description: 'Structured transcript for Gemini 3.8 speech.' },
|
|
129
|
+
multiSpeakerVoiceConfig: {
|
|
130
|
+
description: 'Voice configuration for dialogue speakers.',
|
|
131
|
+
},
|
|
132
|
+
} satisfies Record<
|
|
133
|
+
keyof GoogleVertexSpeechModelOptions,
|
|
134
|
+
ProviderOptionDefinition
|
|
135
|
+
>,
|
|
136
|
+
transcription: {
|
|
137
|
+
languageCodes: {
|
|
138
|
+
description: 'Language hints or automatic language detection.',
|
|
139
|
+
},
|
|
140
|
+
enableAutomaticPunctuation: {
|
|
141
|
+
description: 'Include punctuation in Cloud Speech transcripts.',
|
|
142
|
+
},
|
|
143
|
+
enableWordTimeOffsets: {
|
|
144
|
+
description: 'Include Cloud Speech word timestamps.',
|
|
145
|
+
},
|
|
146
|
+
region: { description: 'Cloud Speech region.' },
|
|
147
|
+
customVocabulary: {
|
|
148
|
+
description: 'Vocabulary hints for Gemini transcription.',
|
|
149
|
+
},
|
|
150
|
+
wordTimestamp: { description: 'Include Gemini word timestamps.' },
|
|
151
|
+
diarization: { description: 'Enable Gemini speaker diarization.' },
|
|
152
|
+
mode: { description: 'Verbatim or smart Gemini transcription formatting.' },
|
|
153
|
+
} satisfies Record<
|
|
154
|
+
| keyof GoogleVertexTranscriptionModelOptions
|
|
155
|
+
| keyof GoogleVertexTranscriptionModelGeminiOptions,
|
|
156
|
+
ProviderOptionDefinition
|
|
157
|
+
>,
|
|
158
|
+
video: {
|
|
159
|
+
pollIntervalMs: { description: 'Polling interval.' },
|
|
160
|
+
pollTimeoutMs: { description: 'Polling timeout.' },
|
|
161
|
+
personGeneration: { description: 'Policy for generating people.' },
|
|
162
|
+
negativePrompt: { description: 'Content to avoid.' },
|
|
163
|
+
generateAudio: { description: 'Generate synchronized audio.' },
|
|
164
|
+
gcsOutputDirectory: { description: 'Cloud Storage output directory.' },
|
|
165
|
+
referenceImages: { description: 'Reference images for video generation.' },
|
|
166
|
+
},
|
|
167
|
+
} as const satisfies ProviderOptionDefinitions;
|
|
168
|
+
|
|
169
|
+
type VertexEntry = ModelEntry<VertexRequestConfig>;
|
|
170
|
+
|
|
171
|
+
function languageEntry(modelId: string): VertexEntry {
|
|
172
|
+
const entry = getGoogleLanguageModelEntry(modelId);
|
|
173
|
+
return {
|
|
174
|
+
capabilities: { language: entry.capabilities.language },
|
|
175
|
+
providerOptions: {
|
|
176
|
+
language: { ...entry.providerOptions.language, serviceTier: false },
|
|
177
|
+
},
|
|
178
|
+
requestConfig: { language: requestConfig(modelId).language },
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const imageModels = [
|
|
183
|
+
'gemini-2.5-flash-image',
|
|
184
|
+
'gemini-3-pro-image-preview',
|
|
185
|
+
'gemini-3.1-flash-image-preview',
|
|
186
|
+
'gemini-nano-banana-2.1',
|
|
187
|
+
];
|
|
188
|
+
|
|
189
|
+
export function getGoogleVertexImageModelEntry(modelId: string): VertexEntry {
|
|
190
|
+
const known = imageModels.includes(modelId);
|
|
191
|
+
return {
|
|
192
|
+
capabilities: {
|
|
193
|
+
image: {
|
|
194
|
+
sizes: {
|
|
195
|
+
description: 'Use aspectRatio; the size option is unsupported.',
|
|
196
|
+
},
|
|
197
|
+
fileInput: known ? true : 'unknown',
|
|
198
|
+
maskInput: known ? false : 'unknown',
|
|
199
|
+
maxImagesPerCall: 1,
|
|
200
|
+
...documentedImageDetails[modelId],
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
providerOptions: {
|
|
204
|
+
image: Object.fromEntries(
|
|
205
|
+
Object.keys(googleVertexProviderOptions.image).map(key => [
|
|
206
|
+
key,
|
|
207
|
+
key === 'serviceTier'
|
|
208
|
+
? false
|
|
209
|
+
: {
|
|
210
|
+
condition:
|
|
211
|
+
'Support follows the Gemini language model and image configuration.',
|
|
212
|
+
},
|
|
213
|
+
]),
|
|
214
|
+
),
|
|
215
|
+
},
|
|
216
|
+
requestConfig: { image: requestConfig(modelId).image },
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function embeddingEntry(modelId: string): VertexEntry {
|
|
221
|
+
const gemini = modelId.startsWith('gemini-embedding-');
|
|
222
|
+
return {
|
|
223
|
+
capabilities: {
|
|
224
|
+
embedding: {
|
|
225
|
+
defaultDimensions: gemini ? 3072 : 768,
|
|
226
|
+
customDimensions: 'unknown',
|
|
227
|
+
...{
|
|
228
|
+
maxEmbeddingsPerCall:
|
|
229
|
+
requestConfig(modelId).embedding!.maxEmbeddingsPerCall,
|
|
230
|
+
supportsParallelCalls: true,
|
|
231
|
+
multimodal:
|
|
232
|
+
requestConfig(modelId).embedding!.endpoint === 'embedContent',
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
providerOptions: {
|
|
237
|
+
embedding: {
|
|
238
|
+
outputDimensionality: 'unknown',
|
|
239
|
+
taskType: 'unknown',
|
|
240
|
+
title: { condition: 'Requires RETRIEVAL_DOCUMENT.' },
|
|
241
|
+
autoTruncate: true,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
requestConfig: { embedding: requestConfig(modelId).embedding },
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function speechEntry(modelId: string): VertexEntry {
|
|
249
|
+
const chirp = requestConfig(modelId).speech?.api === 'cloud-tts';
|
|
250
|
+
return {
|
|
251
|
+
capabilities: {
|
|
252
|
+
speech: { instructions: !chirp, ...{ multiSpeaker: !chirp } },
|
|
253
|
+
},
|
|
254
|
+
providerOptions: {
|
|
255
|
+
speech: {
|
|
256
|
+
multiSpeakerVoiceConfig: chirp ? false : true,
|
|
257
|
+
speechMetadata: chirp
|
|
258
|
+
? false
|
|
259
|
+
: { condition: 'Requires Gemini 3.8 TTS.' },
|
|
260
|
+
turns: chirp ? false : { condition: 'Requires Gemini 3.8 TTS.' },
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
requestConfig: { speech: requestConfig(modelId).speech },
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function transcriptionEntry(modelId: string): VertexEntry {
|
|
268
|
+
const config = requestConfig(modelId).transcription!;
|
|
269
|
+
const gemini = config.api === 'gemini';
|
|
270
|
+
return {
|
|
271
|
+
capabilities: {
|
|
272
|
+
transcription: {
|
|
273
|
+
transcription: !config.live,
|
|
274
|
+
streaming: config.live,
|
|
275
|
+
duration: gemini ? false : true,
|
|
276
|
+
segments: config.live
|
|
277
|
+
? false
|
|
278
|
+
: { condition: 'Requires word timestamps.' },
|
|
279
|
+
language: true,
|
|
280
|
+
...documentedTranscriptionDetails[modelId],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
providerOptions: {
|
|
284
|
+
transcription: {
|
|
285
|
+
languageCodes: true,
|
|
286
|
+
enableAutomaticPunctuation: !gemini,
|
|
287
|
+
enableWordTimeOffsets: !gemini,
|
|
288
|
+
region: !gemini,
|
|
289
|
+
customVocabulary: gemini,
|
|
290
|
+
wordTimestamp: gemini,
|
|
291
|
+
diarization: gemini,
|
|
292
|
+
mode: gemini,
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
requestConfig: { transcription: config },
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function videoEntry(modelId: string): VertexEntry {
|
|
300
|
+
const veo3 = modelId.startsWith('veo-3');
|
|
301
|
+
return {
|
|
302
|
+
capabilities: {
|
|
303
|
+
video: {
|
|
304
|
+
inputs: {
|
|
305
|
+
text: true,
|
|
306
|
+
image: true,
|
|
307
|
+
firstFrame: true,
|
|
308
|
+
lastFrame: {
|
|
309
|
+
condition: 'Requires a Veo model supporting frame interpolation.',
|
|
310
|
+
},
|
|
311
|
+
referenceImage: {
|
|
312
|
+
condition: 'Requires a Veo model supporting reference images.',
|
|
313
|
+
},
|
|
314
|
+
referenceVideo: false,
|
|
315
|
+
},
|
|
316
|
+
generateAudio: veo3,
|
|
317
|
+
aspectRatio: true,
|
|
318
|
+
resolution: true,
|
|
319
|
+
duration: true,
|
|
320
|
+
fps: false,
|
|
321
|
+
seed: true,
|
|
322
|
+
maxVideosPerCall: 4,
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
providerOptions: {
|
|
326
|
+
video: {
|
|
327
|
+
pollIntervalMs: true,
|
|
328
|
+
pollTimeoutMs: true,
|
|
329
|
+
personGeneration: true,
|
|
330
|
+
negativePrompt: true,
|
|
331
|
+
generateAudio: veo3,
|
|
332
|
+
gcsOutputDirectory: true,
|
|
333
|
+
referenceImages: {
|
|
334
|
+
condition: 'Requires a Veo model supporting reference images.',
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const entries: [string, VertexEntry][] = [
|
|
342
|
+
...[
|
|
343
|
+
'gemini-nano-banana-2.1',
|
|
344
|
+
'gemini-4-argon',
|
|
345
|
+
'gemini-3.8-flash',
|
|
346
|
+
'gemini-3.7-flash',
|
|
347
|
+
'gemini-3.6-flash',
|
|
348
|
+
'gemini-3.5-flash',
|
|
349
|
+
'gemini-3.5-flash-lite',
|
|
350
|
+
'gemini-2.5-pro',
|
|
351
|
+
'gemini-2.5-flash',
|
|
352
|
+
'gemini-2.5-flash-lite',
|
|
353
|
+
'gemini-2.0-flash-lite',
|
|
354
|
+
'gemini-2.0-flash',
|
|
355
|
+
'gemini-2.0-flash-001',
|
|
356
|
+
'gemini-1.5-flash',
|
|
357
|
+
'gemini-1.5-flash-001',
|
|
358
|
+
'gemini-1.5-flash-002',
|
|
359
|
+
'gemini-1.5-pro',
|
|
360
|
+
'gemini-1.5-pro-001',
|
|
361
|
+
'gemini-1.5-pro-002',
|
|
362
|
+
'gemini-1.0-pro-001',
|
|
363
|
+
'gemini-1.0-pro-vision-001',
|
|
364
|
+
'gemini-1.0-pro',
|
|
365
|
+
'gemini-1.0-pro-002',
|
|
366
|
+
'gemini-2.0-flash-lite-preview-02-05',
|
|
367
|
+
'gemini-2.5-flash-preview-09-2025',
|
|
368
|
+
'gemini-3-pro-preview',
|
|
369
|
+
'gemini-3-pro-image-preview',
|
|
370
|
+
'gemini-3-flash-preview',
|
|
371
|
+
'gemini-3.1-pro-preview',
|
|
372
|
+
'gemini-3.1-flash-image-preview',
|
|
373
|
+
'gemini-3.1-flash-lite-preview',
|
|
374
|
+
'gemini-2.0-pro-exp-02-05',
|
|
375
|
+
'gemini-2.0-flash-exp',
|
|
376
|
+
].map((id): [string, VertexEntry] => [id, languageEntry(id)]),
|
|
377
|
+
...[
|
|
378
|
+
'gemini-2.5-flash-image',
|
|
379
|
+
'gemini-3-pro-image-preview',
|
|
380
|
+
'gemini-3.1-flash-image-preview',
|
|
381
|
+
'gemini-nano-banana-2.1',
|
|
382
|
+
].map((id): [string, VertexEntry] => [
|
|
383
|
+
id,
|
|
384
|
+
getGoogleVertexImageModelEntry(id),
|
|
385
|
+
]),
|
|
386
|
+
...[
|
|
387
|
+
'textembedding-gecko',
|
|
388
|
+
'textembedding-gecko@001',
|
|
389
|
+
'textembedding-gecko@003',
|
|
390
|
+
'textembedding-gecko-multilingual',
|
|
391
|
+
'textembedding-gecko-multilingual@001',
|
|
392
|
+
'text-multilingual-embedding-002',
|
|
393
|
+
'text-embedding-004',
|
|
394
|
+
'text-embedding-005',
|
|
395
|
+
'gemini-embedding-001',
|
|
396
|
+
'gemini-embedding-2',
|
|
397
|
+
'gemini-embedding-2-preview',
|
|
398
|
+
].map((id): [string, VertexEntry] => [id, embeddingEntry(id)]),
|
|
399
|
+
...[
|
|
400
|
+
'veo-2.0-generate-preview',
|
|
401
|
+
'veo-2.0-generate-exp',
|
|
402
|
+
'veo-2.0-generate-001',
|
|
403
|
+
'veo-3.0-generate-001',
|
|
404
|
+
'veo-3.0-fast-generate-001',
|
|
405
|
+
'veo-3.0-generate-preview',
|
|
406
|
+
'veo-3.0-fast-generate-preview',
|
|
407
|
+
'veo-3.1-generate-001',
|
|
408
|
+
'veo-3.1-fast-generate-001',
|
|
409
|
+
'veo-3.1-generate-preview',
|
|
410
|
+
'veo-3.1-fast-generate-preview',
|
|
411
|
+
].map((id): [string, VertexEntry] => [id, videoEntry(id)]),
|
|
412
|
+
...[
|
|
413
|
+
'gemini-2.5-flash-tts',
|
|
414
|
+
'gemini-2.5-pro-tts',
|
|
415
|
+
'gemini-2.5-flash-lite-preview-tts',
|
|
416
|
+
'gemini-3.1-flash-tts-preview',
|
|
417
|
+
'chirp-3-hd',
|
|
418
|
+
].map((id): [string, VertexEntry] => [id, speechEntry(id)]),
|
|
419
|
+
...['chirp_2', 'chirp_3', 'telephony'].map((id): [string, VertexEntry] => [
|
|
420
|
+
id,
|
|
421
|
+
transcriptionEntry(id),
|
|
422
|
+
]),
|
|
423
|
+
...['gemini-3.5-transcribe', 'gemini-3.5-transcribe-live'].map(
|
|
424
|
+
(id): [string, VertexEntry] => [id, transcriptionEntry(id)],
|
|
425
|
+
),
|
|
426
|
+
];
|
|
427
|
+
|
|
428
|
+
/** A model may expose more than one operation (for example Gemini image models). */
|
|
429
|
+
export const googleVertexModelCatalog: Readonly<Record<string, VertexEntry>> =
|
|
430
|
+
entries.reduce<Record<string, VertexEntry>>((catalog, [id, entry]) => {
|
|
431
|
+
const previous = catalog[id];
|
|
432
|
+
catalog[id] = {
|
|
433
|
+
capabilities: { ...previous?.capabilities, ...entry.capabilities },
|
|
434
|
+
providerOptions: {
|
|
435
|
+
...previous?.providerOptions,
|
|
436
|
+
...entry.providerOptions,
|
|
437
|
+
},
|
|
438
|
+
requestConfig: { ...previous?.requestConfig, ...entry.requestConfig },
|
|
439
|
+
};
|
|
440
|
+
return catalog;
|
|
441
|
+
}, {});
|
|
442
|
+
|
|
443
|
+
const vertexAnthropicModels = {
|
|
444
|
+
'claude-fable-5-1': {
|
|
445
|
+
image: true,
|
|
446
|
+
objectGeneration: true,
|
|
447
|
+
tools: true,
|
|
448
|
+
streaming: true,
|
|
449
|
+
computerUse: true,
|
|
450
|
+
},
|
|
451
|
+
'claude-3-7-sonnet@20250219': {
|
|
452
|
+
image: true,
|
|
453
|
+
objectGeneration: true,
|
|
454
|
+
tools: true,
|
|
455
|
+
streaming: true,
|
|
456
|
+
computerUse: true,
|
|
457
|
+
},
|
|
458
|
+
'claude-3-5-sonnet-v2@20241022': {
|
|
459
|
+
image: true,
|
|
460
|
+
objectGeneration: true,
|
|
461
|
+
tools: true,
|
|
462
|
+
streaming: true,
|
|
463
|
+
computerUse: true,
|
|
464
|
+
},
|
|
465
|
+
'claude-3-5-sonnet@20240620': {
|
|
466
|
+
image: true,
|
|
467
|
+
objectGeneration: true,
|
|
468
|
+
tools: true,
|
|
469
|
+
streaming: true,
|
|
470
|
+
computerUse: false,
|
|
471
|
+
},
|
|
472
|
+
'claude-3-5-haiku@20241022': {
|
|
473
|
+
image: false,
|
|
474
|
+
objectGeneration: true,
|
|
475
|
+
tools: true,
|
|
476
|
+
streaming: true,
|
|
477
|
+
computerUse: false,
|
|
478
|
+
},
|
|
479
|
+
'claude-3-sonnet@20240229': {
|
|
480
|
+
image: true,
|
|
481
|
+
objectGeneration: true,
|
|
482
|
+
tools: true,
|
|
483
|
+
streaming: true,
|
|
484
|
+
computerUse: false,
|
|
485
|
+
},
|
|
486
|
+
'claude-3-haiku@20240307': {
|
|
487
|
+
image: true,
|
|
488
|
+
objectGeneration: true,
|
|
489
|
+
tools: true,
|
|
490
|
+
streaming: true,
|
|
491
|
+
computerUse: false,
|
|
492
|
+
},
|
|
493
|
+
'claude-3-opus@20240229': {
|
|
494
|
+
image: true,
|
|
495
|
+
objectGeneration: true,
|
|
496
|
+
tools: true,
|
|
497
|
+
streaming: true,
|
|
498
|
+
computerUse: false,
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
export const googleVertexAnthropicModelCatalog = Object.fromEntries(
|
|
502
|
+
Object.entries(vertexAnthropicModels).map(([id, support]) => {
|
|
503
|
+
const entry = {
|
|
504
|
+
capabilities: {
|
|
505
|
+
language: {
|
|
506
|
+
inputs: { image: support.image, audio: false },
|
|
507
|
+
objectGeneration: support.objectGeneration,
|
|
508
|
+
tools: {
|
|
509
|
+
usage: support.tools,
|
|
510
|
+
streaming: support.streaming,
|
|
511
|
+
computerUse: support.computerUse,
|
|
512
|
+
},
|
|
513
|
+
reasoning: { support: 'unknown' },
|
|
514
|
+
sampling: {
|
|
515
|
+
temperature: 'unknown',
|
|
516
|
+
topP: 'unknown',
|
|
517
|
+
logprobs: false,
|
|
518
|
+
},
|
|
519
|
+
},
|
|
520
|
+
},
|
|
521
|
+
} as const;
|
|
522
|
+
return [id, entry satisfies ModelEntry];
|
|
523
|
+
}),
|
|
524
|
+
);
|
|
525
|
+
const vertexXaiModels = {
|
|
526
|
+
'xai/grok-4.20-reasoning': { reasoning: true },
|
|
527
|
+
'xai/grok-4.20-non-reasoning': { reasoning: false },
|
|
528
|
+
'xai/grok-4.1-fast-reasoning': { reasoning: true },
|
|
529
|
+
'xai/grok-4.1-fast-non-reasoning': { reasoning: false },
|
|
530
|
+
};
|
|
531
|
+
export const googleVertexXaiModelCatalog = Object.fromEntries(
|
|
532
|
+
Object.entries(vertexXaiModels).map(([id, support]) => {
|
|
533
|
+
const entry = {
|
|
534
|
+
capabilities: {
|
|
535
|
+
language: {
|
|
536
|
+
inputs: { image: 'unknown', audio: 'unknown' },
|
|
537
|
+
objectGeneration: 'unknown',
|
|
538
|
+
tools: { usage: 'unknown', streaming: 'unknown' },
|
|
539
|
+
reasoning: { support: support.reasoning },
|
|
540
|
+
sampling: {
|
|
541
|
+
temperature: 'unknown',
|
|
542
|
+
topP: 'unknown',
|
|
543
|
+
logprobs: 'unknown',
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
},
|
|
547
|
+
} as const;
|
|
548
|
+
return [id, entry satisfies ModelEntry];
|
|
549
|
+
}),
|
|
550
|
+
);
|
|
551
|
+
const vertexMaasModels = {
|
|
552
|
+
'deepseek-ai/deepseek-r1-0528-maas': { publisher: 'DeepSeek' },
|
|
553
|
+
'deepseek-ai/deepseek-v3.1-maas': { publisher: 'DeepSeek' },
|
|
554
|
+
'deepseek-ai/deepseek-v3.2-maas': { publisher: 'DeepSeek' },
|
|
555
|
+
'openai/gpt-oss-120b-maas': { publisher: 'OpenAI' },
|
|
556
|
+
'openai/gpt-oss-20b-maas': { publisher: 'OpenAI' },
|
|
557
|
+
'meta/llama-4-maverick-17b-128e-instruct-maas': { publisher: 'Meta' },
|
|
558
|
+
'meta/llama-4-scout-17b-16e-instruct-maas': { publisher: 'Meta' },
|
|
559
|
+
'minimax/minimax-m2-maas': { publisher: 'MiniMax' },
|
|
560
|
+
'qwen/qwen3-coder-480b-a35b-instruct-maas': { publisher: 'Qwen' },
|
|
561
|
+
'qwen/qwen3-next-80b-a3b-instruct-maas': { publisher: 'Qwen' },
|
|
562
|
+
'qwen/qwen3-next-80b-a3b-thinking-maas': { publisher: 'Qwen' },
|
|
563
|
+
'moonshotai/kimi-k2-thinking-maas': { publisher: 'Moonshot' },
|
|
564
|
+
};
|
|
565
|
+
export const googleVertexMaasModelCatalog = Object.fromEntries(
|
|
566
|
+
Object.entries(vertexMaasModels).map(([id, support]) => {
|
|
567
|
+
const entry = {
|
|
568
|
+
capabilities: {
|
|
569
|
+
language: {
|
|
570
|
+
inputs: { image: 'unknown', audio: 'unknown' },
|
|
571
|
+
objectGeneration: 'unknown',
|
|
572
|
+
tools: { usage: 'unknown', streaming: 'unknown' },
|
|
573
|
+
reasoning: { support: 'unknown' },
|
|
574
|
+
sampling: {
|
|
575
|
+
temperature: 'unknown',
|
|
576
|
+
topP: 'unknown',
|
|
577
|
+
logprobs: 'unknown',
|
|
578
|
+
},
|
|
579
|
+
publisher: support.publisher,
|
|
580
|
+
},
|
|
581
|
+
},
|
|
582
|
+
requestConfig: requestConfig(id),
|
|
583
|
+
} as const;
|
|
584
|
+
return [id, entry satisfies ModelEntry<VertexRequestConfig>];
|
|
585
|
+
}),
|
|
586
|
+
);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getGoogleVertexRequestConfig } from './google-vertex-model-catalog-config';
|
|
1
2
|
import {
|
|
2
3
|
GoogleInteractionsLanguageModel,
|
|
3
4
|
GoogleLanguageModel,
|
|
@@ -51,10 +52,8 @@ const EXPRESS_MODE_BASE_URL =
|
|
|
51
52
|
// Tuned models are served from a deployed endpoint and addressed by their
|
|
52
53
|
// `endpoints/{id}` resource, which replaces `publishers/google/models/{id}`.
|
|
53
54
|
// https://cloud.google.com/vertex-ai/generative-ai/docs/deploy/overview
|
|
54
|
-
const ENDPOINT_MODEL_PREFIX = 'endpoints/';
|
|
55
|
-
|
|
56
55
|
function isEndpointModelId(modelId: string): boolean {
|
|
57
|
-
return modelId.
|
|
56
|
+
return getGoogleVertexRequestConfig(modelId).language?.endpoint === true;
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
// set `x-goog-api-key` header to API key for express mode
|
|
@@ -381,7 +380,7 @@ export function createGoogleVertex(
|
|
|
381
380
|
});
|
|
382
381
|
|
|
383
382
|
const createSpeechModel = (modelId: GoogleVertexSpeechModelId) => {
|
|
384
|
-
if (modelId.
|
|
383
|
+
if (getGoogleVertexRequestConfig(modelId).speech?.api === 'cloud-tts') {
|
|
385
384
|
if (apiKey) {
|
|
386
385
|
throw new Error(
|
|
387
386
|
'Google Vertex Chirp speech models do not support Express Mode API keys. Use standard Google Cloud credentials instead.',
|
|
@@ -415,7 +414,7 @@ export function createGoogleVertex(
|
|
|
415
414
|
// Gemini transcription models (`gemini-3.5-transcribe[-live]`) use the
|
|
416
415
|
// Vertex generateContent / Live API surfaces; everything else routes to
|
|
417
416
|
// Cloud Speech-to-Text (Chirp, telephony).
|
|
418
|
-
if (modelId.
|
|
417
|
+
if (getGoogleVertexRequestConfig(modelId).transcription?.api === 'gemini') {
|
|
419
418
|
return new GoogleVertexGeminiTranscriptionModel(modelId, {
|
|
420
419
|
provider: config.provider,
|
|
421
420
|
baseURL: loadBaseURL(),
|