powerful-magician-63563
12/30/2025, 12:16 PMtall-airline-16756
12/30/2025, 12:16 PMtall-airline-16756
12/30/2025, 12:17 PMinput_audio_transcription and set language to the desired BCP-47 code (for example "en" for English). This prevents automatic language detection and keeps transcriptions in that language.
• Example pattern:
session = AgentSession(
llm=google.realtime.RealtimeModel(
model="gemini-2.5-flash",
input_audio_transcription=google.types.InputTextTranscription(
enabled=True,
language="en"
),
),
)
2) Use a separate, deterministic STT pipeline and feed text to Gemini
• Send audio to a dedicated STT provider you control (Google Cloud STT, Deepgram, etc.) with a fixed language setting.
• Provide the resulting text to Gemini in text-only mode for response generation while still using Gemini for speech output if needed.
• This gives more reliable language control and lets you handle retries/quality checks before sending text to Gemini.
Which would you prefer to try first — forcing the plugin language or using an external STT? If you want, tell me the language code you need and the SDK/language you’re using and I’ll give exact code snippets.
Sources: Gemini Live API plugin | LiveKit docs | Realtime model plugins | LiveKit Docspowerful-magician-63563
12/30/2025, 12:21 PMtall-airline-16756
12/30/2025, 12:22 PMpowerful-magician-63563
12/30/2025, 12:23 PMtall-airline-16756
12/30/2025, 12:23 PMpowerful-magician-63563
12/30/2025, 12:24 PMtall-airline-16756
12/30/2025, 12:25 PMllm=google.realtime.RealtimeModel(...) and set stt=assemblyai.STT(language_code="es") (or google.STT(..., language_code="es-ES")) in the same AgentSession.
• Disable Gemini’s automatic activity detection if you want STT-based turn detection.
• This streams the same audio to Gemini for realtime audio processing and to the external STT for deterministic Spanish transcription (captions, logging, or turn detection).
2) Manual audio forking (advanced)
• Duplicate the audio frames client- or server-side.
• Send one stream to Gemini Live API and the other to your chosen STT (Deepgram, AssemblyAI, Google STT).
• This gives full control over buffering, retries, and post-processing.
If you tell me your tech stack (Python or Node), whether you need captions or backend logging, and which STT provider you prefer, I’ll provide exact configuration or code snippets for Spanish.
Sources: Gemini Live API plugin | LiveKit docs | Google AI and LiveKit | LiveKit Docs | Speech-to-text (STT) models | LiveKit Docspowerful-magician-63563
12/31/2025, 2:50 PMtall-airline-16756
12/31/2025, 2:50 PMwebsockets.exceptions.ConnectionClosedError in your receive loop, log e.code and full traceback, close/cleanup the session, wait, then recreate the session and resume.
3) Log contextual metadata when it happens
• Room ID, agent/job ID, timestamps, model name (gemini-2.5-flash-native-audio-preview-09-2025), region/project, and recent request rate. Include a short audio sample filename or size if reproducible.
4) Check quotas, billing, and API health
• Confirm billing is active and check Google Cloud/Generative AI quotas for your project and the Google Cloud status dashboard for any incidents at the time of failures.
5) Validate audio and config
• Ensure audio frames match expected sample rate/format and you’re not sending malformed frames mid-stream. If you fork audio to STT in parallel, confirm no stream corruption occurs.
• If you disabled automatic activity detection or changed VAD, try toggling that to see if behavior changes.
6) Upgrade dependencies
• Make sure you’re on the latest livekit-agents and google-genai packages — connection resilience fixes are regularly released.
7) Minimal repro test
• Run a minimal script that only creates a realtime session, streams a short clean audio clip, and receives responses. If the minimal test fails, the issue is likely server-side or quota-related.
If you want, I can give a short example of:
• A Python retry wrapper around the receive loop, or
• A minimal repro script to isolate client vs. server issues.
Which would help you most right now — the retry code snippet or the minimal repro script? Also tell me whether you’re running this locally or in a cloud environment and whether failures correlate with traffic spikes.