@ai-sdk/google-vertex
Version:
61 lines (53 loc) • 1.93 kB
text/typescript
import {
lazySchema,
zodSchema,
type InferSchema,
} from '@ai-sdk/provider-utils';
import { z } from 'zod/v4';
import type { GoogleVertexModelIds } from '../google-vertex-model-catalog';
export type GoogleVertexGeminiTranscriptionModelId =
| GoogleVertexModelIds['geminiTranscription']
| (string & {});
/**
* Speech recognition options for Gemini transcription models on Vertex,
* shared by unary (`gemini-3.5-transcribe`) and live
* (`gemini-3.5-transcribe-live`) variants. Maps onto Google's
* `AudioTranscriptionConfig`.
*/
export const googleVertexGeminiTranscriptionModelOptions = lazySchema(() =>
zodSchema(
z.object({
/**
* BCP-47 language codes providing hints about the languages present in the
* audio. If omitted or empty, defaults to automatic language detection.
*/
languageCodes: z.array(z.string()).optional(),
/**
* Custom vocabulary phrases, which bias the speech recognition model
* toward recognizing specific terms.
*/
customVocabulary: z.array(z.string()).optional(),
/**
* Enables word-level timestamp generation.
*/
wordTimestamp: z.boolean().optional(),
/**
* Enables speaker diarization.
*/
diarization: z.boolean().optional(),
/**
* Transcription output formatting mode.
*
* - `VERBATIM` (default): exact literal transcript preserving filler
* words, repetitions, and false starts.
* - `SMART`: cleans up and structures the transcript in real time —
* disfluency removal, inline self-corrections, structured formatting
* (lists, numbers, dates, paragraph breaks), and grammar/casing polish.
*/
mode: z.enum(['SMART', 'VERBATIM']).optional(),
}),
),
);
export type GoogleVertexTranscriptionModelGeminiOptions = InferSchema<
typeof googleVertexGeminiTranscriptionModelOptions
>;