Implementation Patterns: Batch vs. Streaming
Gemini 3.5 Transcribe provides two specialized model paths depending on your latency and input requirements. Both are accessed via the Google GenAI SDK using a unified client configuration.
- Synchronous Batch Processing: Best for pre-recorded audio files. Use the
generate_contentAPI to process files loaded into memory as bytes or referenced directly via Google Cloud Storage URIs. This pattern is ideal for indexing, archival, or post-processing tasks where real-time delivery is not required. - Real-Time Streaming: Utilizes the Live API via WebSockets for low-latency applications. This requires a persistent session where you run two concurrent coroutines: one to stream raw PCM audio data (using
send_real_time_input) and another to handle incoming transcriptions. The API distinguishes betweeninterim_input_transcription(useful for live caption updates) andinput_transcription(finalized segments for permanent storage).
Configuration for Production Accuracy
To move beyond basic transcription, the model exposes specific configuration knobs that improve accuracy and utility for enterprise use cases:
- Word-Level Timestamps: By setting
word_timestamptotrue, the model returns start and end offsets for every word, enabling precise video alignment and search indexing. - Speaker Diarization: Enabling this feature attaches speaker labels to response parts, allowing developers to reconstruct dialogue and attribute speech to specific individuals.
- Language Control: While the model defaults to auto-detection, you can pin specific language codes to improve predictability or handle multilingual audio files.
- Custom Vocabulary Biasing: You can supply a list of domain-specific phrases, product names, or unique spellings to bias the model, significantly reducing errors in technical or niche contexts.