@ai-sdk/google-vertex 5.0.65 → 5.0.67

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.
@@ -24,6 +24,7 @@ import {
24
24
  withUserAgentSuffix,
25
25
  type FetchFunction,
26
26
  type Resolvable,
27
+ type WebSocketConstructor,
27
28
  } from '@ai-sdk/provider-utils';
28
29
  import { VERSION } from './version';
29
30
  import type { GoogleVertexConfig } from './google-vertex-config';
@@ -36,6 +37,7 @@ import { GoogleVertexCloudTTSSpeechModel } from './google-vertex-cloud-tts-speec
36
37
  import { googleVertexTools } from './google-vertex-tools';
37
38
  import { GoogleVertexTranscriptionModel } from './google-vertex-transcription-model';
38
39
  import type { GoogleVertexTranscriptionModelId } from './google-vertex-transcription-model-options';
40
+ import { GoogleVertexGeminiTranscriptionModel } from './gemini-transcription/google-vertex-gemini-transcription-model';
39
41
  import { GoogleVertexVideoModel } from './google-vertex-video-model';
40
42
  import type { GoogleVertexVideoModelId } from './google-vertex-video-settings';
41
43
  import type { GoogleVertexSpeechModelId } from './google-vertex-speech-model-options';
@@ -184,6 +186,13 @@ export interface GoogleVertexProviderSettings {
184
186
  * Base URL for the Google Vertex API calls.
185
187
  */
186
188
  baseURL?: string;
189
+
190
+ /**
191
+ * Custom WebSocket implementation for streaming transcription. Useful for
192
+ * runtimes that need a WebSocket constructor with header support (e.g. the
193
+ * `ws` package in Node.js, which Vertex's OAuth Bearer header requires).
194
+ */
195
+ webSocket?: WebSocketConstructor;
187
196
  }
188
197
 
189
198
  /**
@@ -359,6 +368,22 @@ export function createGoogleVertex(
359
368
  }
360
369
 
361
370
  const config = createConfig('transcription');
371
+
372
+ // Gemini transcription models (`gemini-3.5-transcribe[-live]`) use the
373
+ // Vertex generateContent / Live API surfaces; everything else routes to
374
+ // Cloud Speech-to-Text (Chirp, telephony).
375
+ if (modelId.startsWith('gemini')) {
376
+ return new GoogleVertexGeminiTranscriptionModel(modelId, {
377
+ provider: config.provider,
378
+ baseURL: loadBaseURL(),
379
+ headers: config.headers,
380
+ fetch: config.fetch,
381
+ webSocket: options.webSocket,
382
+ project: loadGoogleVertexProject(),
383
+ location: loadGoogleVertexLocation(),
384
+ });
385
+ }
386
+
362
387
  return new GoogleVertexTranscriptionModel(modelId, {
363
388
  provider: config.provider,
364
389
  headers: config.headers,
package/src/index.ts CHANGED
@@ -30,4 +30,9 @@ export type {
30
30
  GoogleVertexProvider,
31
31
  GoogleVertexProviderSettings,
32
32
  } from './google-vertex-provider';
33
+ export { GoogleVertexGeminiTranscriptionModel } from './gemini-transcription/google-vertex-gemini-transcription-model';
34
+ export type {
35
+ GoogleVertexGeminiTranscriptionModelId,
36
+ GoogleVertexTranscriptionModelGeminiOptions,
37
+ } from './gemini-transcription/google-vertex-gemini-transcription-model-options';
33
38
  export { VERSION } from './version';