This message was deleted.
# ask-ai
s
This message was deleted.
t
Thanks for reaching out, Durgesh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — you want to restrict the STT input language when using the Gemini Realtime model. You can do that by setting the language in the model's
input_audio_transcription
(or
inputAudioTranscription
) option. Examples: Python
Copy code
from livekit.plugins import google
from google.genai import types

session = AgentSession(
    llm=google.realtime.RealtimeModel(
        input_audio_transcription=types.AudioTranscription(
            language="es"  # restricts STT to Spanish (ISO-639-1 code)
        ),
        voice="Puck",
        instructions="You are a helpful assistant."
    ),
    vad=silero.VAD.load()
)
Node.js / TypeScript
Copy code
import * as google from '@livekit/agents-plugin-google';

const session = new voice.AgentSession({
  llm: new google.realtime.RealtimeModel({
    inputAudioTranscription: {
      language: "es" // restricts STT to Spanish (ISO-639-1 code)
    },
    voice: "Puck",
    instructions: "You are a helpful assistant."
  }),
  vad: await silero.VAD.load()
});
Notes: • Use an ISO-639-1 code (e.g.,
en
,
es
,
fr
). • If you don’t set this, transcription may attempt to detect/handle multiple languages. Would you like an example for a different language or help adding this to your existing code? Sources: Gemini Live API plugin | LiveKit docs
r
can I pass in multiple languages ?
t
You cannot pass multiple languages simultaneously. The Gemini Realtime
input_audio_transcription
language field accepts a single ISO-639-1 code (for example
en
,
es
,
fr
) to restrict STT to one language. If you need multi-language support, would you like options for: • detecting language first and then reconfiguring transcription per detected language, or • running parallel transcriptions with separate model instances for each language?
r
input_audio_transcription=genai_types.AudioTranscription( AttributeError: module 'google.genai.types' has no attribute 'AudioTranscription'
t
Thanks — I see you're hitting
AttributeError: module 'google.genai.types' has no attribute 'AudioTranscription'
when trying to set
input_audio_transcription
. Let's troubleshoot and fix that. Could you tell me: • which LiveKit / agents plugin package and version you have installed (pip show livekit-agents or contents of requirements.txt)? • the exact import lines you're using now? Quick fixes to try now: • Use the plugin's types import instead of
google.genai.types
. Example:
Copy code
from livekit.plugins.google.types import AudioTranscription
from livekit.plugins import google
from livekit.agents import AgentSession

session = AgentSession(
    llm=google.realtime.RealtimeModel(
        model="gemini-2.5-flash",
        input_audio_transcription=AudioTranscription(language="es")
    )
)
• If that import still fails, upgrade the package:
pip install --upgrade "livekit-agents[google]"
(ensure version is ~1.3+). Note on language restriction: the plugin supports setting a single ISO-639-1 code via
language
(e.g.,
en
,
es
). Passing multiple languages at once is not supported. If you share your package version and current imports, I’ll give the exact code or next steps. Sources: Gemini Live API plugin | LiveKit docs
r
The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/ubuntu/anaconda3/envs/icall-backend/lib/python3.10/site-packages/livekit/plugins/google/stt.py", line 542, in _run task.result() File "/home/ubuntu/anaconda3/envs/icall-backend/lib/python3.10/site-packages/livekit/plugins/google/stt.py", line 442, in process_stream async for resp in stream: File "/home/ubuntu/anaconda3/envs/icall-backend/lib/python3.10/site-packages/google/api_core/grpc_helpers_async.py", line 109, in _wrapped_aiter raise exceptions.from_grpc_error(rpc_error) from rpc_error google.api_core.exceptions.InvalidArgument: 400 Config contains unsupported fields. See
error_details_ext
extension for details. [field_violations { field: "config.features.enable_automatic_punctuation" description: "Recognizer does not support feature: automatic_punctuation" } ]
t
Thanks — I see the traceback and the 400 error caused by an unsupported STT field (
enable_automatic_punctuation
) being sent to the Google/Gemini realtime path. What happened: Gemini Realtime uses its own built-in transcription and rejects Google STT config fields (like automatic punctuation). That causes the InvalidArgument error in livekit/plugins/google/stt.py when the plugin forwards an unsupported config. What to do next: • Stop passing Google STT config objects into the Gemini realtime model. Instead set the language via the RealtimeModel parameter: ◦ Python: use
language_code="es-ES"
in
google.realtime.RealtimeModel(...)
◦ Node: use
languageCode: "es-ES"
in
new google.realtime.RealtimeModel({...})
• Remove or avoid
input_audio_transcription
/ external STT config that includes fields such as
enable_automatic_punctuation
. • If you need punctuation or other STT features not supported by Gemini Realtime, run an external STT pipeline separately (not via
input_audio_transcription
) and feed its results into your app. To help further, please share: • The AgentSession / RealtimeModel code you're running (exact snippet). • Output of: ◦
pip show livekit-agents
and
pip show livekit-plugins-google
(or your package manager equivalents). I can then point to the exact code change or patch to remove the unsupported fields. Sources: Gemini Live API plugin | LiveKit docs | Realtime model plugins | LiveKit Docs
r
its giving error in below code llm = google.LLM( model = model_id, vertexai = vertexai, project = "icalls", location = "us-central1", temperature = temperature, # tool_choice="required", max_output_tokens=200, # Limit for faster responses in voice context top_p=0.95, # Nucleus sampling for quality # automatic_function_calling_config={ # "enabled": True, # "max_iterations": 2, # } ), stt = google.STT( languages=["en-US",language], detect_language=True, interim_results=True, use_streaming=True, sample_rate=16000, # model="long", # automatic_punctuation=False, enable_automatic_punctuation=False, punctuate=False, ), tts = google.TTS( language=language, voice_name=language+"-Chirp3-HD-"+voice_id, # gender=gender, volume_gain_db=2.0, use_streaming=True, pitch=0 # location="us-central1", ),
t
Thanks — I see the failing code and the root cause. You're passing Google STT config (like
enable_automatic_punctuation
, multiple
languages
,
punctuate
) into the Gemini realtime path, which rejects those fields. Gemini Realtime uses its own built-in STT and expects language via the RealtimeModel
language_code
(BCP-47), not the Google STT plugin config. What to change • Remove or stop passing
google.STT(...)
options into the Gemini realtime model when that model is used for transcription. • Set the language on the RealtimeModel with
language_code
. • If you still need a separate STT instance (for turn detection or a different pipeline), run it independently and do not feed its config fields into the Gemini realtime config. Suggested corrected pattern (Python sketch)
Copy code
# Use RealtimeModel for Gemini realtime audio + language setting
llm = google.realtime.RealtimeModel(
    model=model_id,
    language_code="en-US",   # set desired BCP-47 language
    temperature=temperature,
    max_output_tokens=200,
    top_p=0.95,
    # no input_audio_transcription / no external STT fields here
)

# If you need an external STT process, run it separately (not passed into Gemini)
external_stt = google.STT(
    languages=["en-US", language],
    detect_language=True,
    interim_results=True,
    use_streaming=True,
    sample_rate=16000,
    # DO NOT pass enable_automatic_punctuation or other Gemini-unsupported fields
)
Quick checklist to avoid the InvalidArgument error • Remove
enable_automatic_punctuation
,
punctuate
, and similar fields from any config that ends up sent to the Gemini realtime plugin. • Do not pass an array of languages to Gemini; set a single
language_code
on the
RealtimeModel
. • If you need punctuation or multi-language transcription, perform that outside Gemini (post-process or separate STT service). If you want, share: • The exact AgentSession / RealtimeModel/llm instantiation code you use now, and •
pip show livekit-agents
and
pip show livekit-plugins-google
outputs I’ll give the minimal patch or code edits to fix the error.