numerous-lighter-25835
05/11/2026, 2:43 PMtall-airline-16756
05/11/2026, 2:43 PMtall-airline-16756
05/11/2026, 2:44 PMFallbackAdapter with those two models. I’m responding about language configuration for the FallbackAdapter and the individual STT model instances.
Short answer: set the language per STT instance — the FallbackAdapter does not auto-propagate a language setting.
What to do:
• For Deepgram Nova-3, instantiate with language="multi" (or the provider’s multilingual option) so it will auto-detect.
• For AssemblyAI, use a multilingual-capable model string or instantiate with the multilingual model (don’t use :en if you need multiple languages).
• Example:
stt = stt.FallbackAdapter([
inference.STT.from_model_string("assemblyai/universal-streaming-multilingual"),
inference.STT(model="deepgram/nova-3", language="multi"),
])
Quick questions so I can give exact code for your setup:
• Are you using the Python SDK (example above) or a different language?
• Which AssemblyAI model/version do you want to use (universal-streaming vs universal-streaming-multilingual)?
• Do you want automatic language detection, or will you switch languages programmatically per session?
Tell me those and I’ll give the precise snippet.
Sources: Speech-to-text (STT) models overview | LiveKit Documentation | AssemblyAI STT | LiveKit Documentation | LiveKit Inference | LiveKit Documentation, with interactive elementsnumerous-lighter-25835
05/11/2026, 2:47 PMtall-airline-16756
05/11/2026, 2:48 PMFallbackAdapter to transcribe Urdu.
Short answer: set language="ur" (or ur-PK) on each STT instance that supports Urdu. The FallbackAdapter will use whatever language each model is configured with.
Example (Python):
stt = stt.FallbackAdapter([
inference.STT(model="deepgram/nova-3", language="ur"), # Deepgram supports Urdu
inference.STT(model="xai/stt-1", language="ur"), # xAI supports Urdu
inference.STT(model="sarvam/stt", language="ur"), # Sarvam supports Urdu
])
Quick question so I can tailor the exact snippet:
• Which model(s) do you want to use for Urdu (Deepgram, AssemblyAI, xAI, Sarvam, or others)? Sources: Speech-to-text (STT) models overview | LiveKit Documentation | Sarvam STT plugin guide | LiveKit Documentation, with interactive elementsnumerous-lighter-25835
05/11/2026, 2:49 PMtall-airline-16756
05/11/2026, 2:50 PMnumerous-lighter-25835
05/11/2026, 2:50 PMnumerous-lighter-25835
05/11/2026, 2:50 PMnumerous-lighter-25835
05/11/2026, 2:51 PMtall-airline-16756
05/11/2026, 2:51 PMpip install livekit
# plus any provider SDKs you use (e.g., deepgram-sdk, google-cloud)
2) Example AgentSession pipeline (Python):
from livekit import AgentSession, inference, stt as stt_module, tts as tts_module, llm as llm_module
# --- Configuration (replace these) ---
LIVEKIT_API_KEY = "LIVEKIT_API_KEY"
LIVEKIT_API_SECRET = "LIVEKIT_API_SECRET"
LIVEKIT_WS_URL = "wss://your-livekit-server" # if needed
GOOGLE_API_KEY = "YOUR_GOOGLE_API_KEY" # for Google LLM
ROOM_NAME = "urdu-room"
AGENT_NAME = "urdu-agent"
# --- Build STT components configured for Urdu ---
# Use Deepgram / xAI / Sarvam models that support Urdu.
# Example using generic inference.STT constructor (models that support 'ur'):
deepgram_stt = inference.STT(model="deepgram/nova-3", language="ur")
xai_stt = inference.STT(model="xai/stt-1", language="ur")
# Fallback adapter: tries deepgram first, then xai
stt_adapter = stt_module.FallbackAdapter([deepgram_stt, xai_stt])
# --- LLM: Google (use your API key) ---
# Use an llm wrapper that accepts provider and api_key. Replace model name as appropriate.
google_llm = llm_module.GoogleLLM(api_key=GOOGLE_API_KEY, model="gemini-pro") # adjust model string as needed
# --- Optional TTS for Urdu (if you want audio replies) ---
# Use a TTS provider that supports Urdu (e.g., xAI or Sarvam if available).
tts = tts_module.TTS(model="xai/tts-1", language="ur") # replace with a TTS model that supports Urdu
# --- Assemble AgentSession pipeline ---
agent_session = AgentSession(
name=AGENT_NAME,
stt=stt_adapter,
llm=google_llm,
tts=tts, # omit or set to None if you want text-only replies
# Additional configuration like session timeout, voice settings, etc., can go here.
)
# --- Start the AgentSession and connect to a room ---
def start_agent_session():
# Connect (this is pseudocode; use your SDK's connect/start method)
agent_session.connect(api_key=LIVEKIT_API_KEY, api_secret=LIVEKIT_API_SECRET, room=ROOM_NAME, ws_url=LIVEKIT_WS_URL)
# Register event handlers (incoming audio, messages)
@agent_session.on("transcript")
def on_transcript(event):
# event.text contains Urdu transcript
print("User (transcript):", event.text)
# Pass transcript to Google LLM to generate a response
response = agent_session.llm.generate(prompt=event.text, language="ur") # ensure prompt/lang handling for Urdu
print("LLM response:", response.text)
# If TTS configured, synthesize and send audio back to room
if agent_session.tts:
audio_bytes = agent_session.tts.synthesize(response.text, language="ur")
agent_session.send_audio(audio_bytes)
else:
agent_session.send_text(response.text)
# Start listening / running loop
agent_session.start() # SDK-specific; starts processing streams
if __name__ == "__main__":
start_agent_session()
Notes and quick tips:
• Set each STT instance’s language="ur" (or ur-PK) so Urdu is used — the FallbackAdapter will honor per-model settings.
• Use a Google LLM model name compatible with your API key (adjust model="gemini-pro" to your allowed model).
• If you don’t want voiced replies, set tts=None and send text responses.
• Test end-to-end with short Urdu utterances and log transcripts to verify language detection.
If you want, I can:
• Provide a more concrete example using a specific STT/TTS SDK (Deepgram or Sarvam) with real init code.
• Swap to text-only flow.
• Show exact code for sending audio into and out of a LiveKit room.
Which of those would you like next?
, with interactive elementsnumerous-lighter-25835
05/11/2026, 2:52 PMtall-airline-16756
05/11/2026, 2:52 PM"ur" or "ur-PK") — from_model_string("assemblyai/universal-streaming-multilingual") is fine if that model includes Urdu, but specify language explicitly when possible.
• deepgram/nova-3 should be language="ur" (or "multi" if you want auto-detect, but set "ur" for explicit Urdu).
• Ensure your Google Gemini credentials are wired to the LLM adapter (the adapter must be created with your Google API key).
• Use a TTS model that supports Urdu (e.g., Sarvam or a provider you confirmed supports Urdu); set language="ur" for TTS.
Concise Python AgentSession example (replace placeholders):
from livekit import AgentSession, inference, stt as stt_module, llm as llm_module, tts as tts_module
from livekit.turn_detection import MultilingualModel
# Replace these with your values
LIVEKIT_API_KEY = "LIVEKIT_API_KEY"
LIVEKIT_API_SECRET = "LIVEKIT_API_SECRET"
GOOGLE_API_KEY = "YOUR_GOOGLE_API_KEY"
# STT: explicit Urdu on each model
stt_adapter = stt_module.FallbackAdapter([
inference.STT.from_model_string("assemblyai/universal-streaming-multilingual"), # ensure this supports ur
inference.STT(model="deepgram/nova-3", language="ur"),
inference.STT(model="xai/stt-1", language="ur"), # optional extra Urdu-capable model
])
# LLM: Google Gemini via API key (ensure SDK/adapter supports api_key init)
google_llm = inference.LLM.from_model_string("google/gemini-2.5-flash", api_key=GOOGLE_API_KEY)
llm_adapter = llm_module.FallbackAdapter([
google_llm,
inference.LLM.from_model_string("openai/gpt-4.1-mini"), # fallback
])
# TTS: pick Urdu-capable provider; set language
tts_adapter = tts_module.FallbackAdapter([
inference.TTS.from_model_string("sarvam/tts", language="ur"), # example; replace with real model id
inference.TTS.from_model_string("inworld/inworld-tts-1", language="ur"),
])
session = AgentSession(
stt=stt_adapter,
llm=llm_adapter,
tts=tts_adapter,
turn_detection=MultilingualModel(), # supports multilingual turn detection
vad=None, # set your VAD implementation or ctx.proc.userdata["vad"]
preemptive_generation=True,
# add other AgentSession settings as needed
)
# Connect/start — use your SDK's connection method and auth
session.connect(api_key=LIVEKIT_API_KEY, api_secret=LIVEKIT_API_SECRET)
session.start()
Quick notes
• If you want automatic language detection, set Deepgram to language="multi" or use a multilingual AssemblyAI model that advertises auto-detect; otherwise set language="ur".
• The FallbackAdapter uses the language configured per model — it does not unify languages for you.
• Make sure your Google/Gemini usage is permitted by your API key and that the LLM adapter accepts api_key during instantiation.
• Test end-to-end with short Urdu utterances and log transcripts to verify STT/TTS output.
If you want, I can:
• Produce a version that wires your actual VAD object (ctx.proc.userdata["vad"]) into the session.
• Swap TTS to a concrete provider you already have keys for and show the exact init calls.
Which of those would you like next?
, with interactive elementsnumerous-lighter-25835
05/11/2026, 2:54 PMtall-airline-16756
05/11/2026, 2:54 PMnumerous-lighter-25835
05/11/2026, 2:55 PMtall-airline-16756
05/11/2026, 2:56 PMnumerous-lighter-25835
05/11/2026, 3:23 PMtall-airline-16756
05/11/2026, 3:24 PMnumerous-lighter-25835
05/11/2026, 3:52 PMtall-airline-16756
05/11/2026, 3:53 PMlanguage="ur". The provider refused to create the STT session.
What to do:
• Use an STT model that supports Urdu (Google Cloud STT or Sarvam are confirmed options), or remove language="ur" from Deepgram.
• If you want Urdu voice input, switch your STT entry to a Google Cloud STT plugin (or another Urdu-capable provider) and keep Deepgram only as a fallback if you set it to language="multi" and it actually supports Urdu for your deployment (your error shows it doesn't).
Quick fix in your code style — replace the STT block with Google Cloud STT (requires service account JSON via GOOGLE_APPLICATION_CREDENTIALS):
from livekit.plugins import google
session = AgentSession(
stt=stt.FallbackAdapter([
google.STT(model="cloud/speech-to-text", languages="ur"), # Google STT supports Urdu
inference.STT(model="deepgram/nova-3", language="multi"), # optional fallback (keep multi if supported)
]),
llm=llm.FallbackAdapter([
inference.LLM.from_model_string("google/gemini-2.5-flash", api_key=GOOGLE_API_KEY),
inference.LLM.from_model_string("openai/gpt-4.1-mini"),
]),
tts=tts.FallbackAdapter([
google.TTS(language="ur-PK", voice_name="ur-PK-Standard-A"), # Google TTS supports Urdu
inference.TTS.from_model_string("inworld/inworld-tts-1"),
]),
turn_detection=MultilingualModel(),
vad=ctx.proc.userdata["vad"],
preemptive_generation=True,
)
Notes:
• Set GOOGLE_APPLICATION_CREDENTIALS to your Google service account JSON for Cloud STT/TTS.
• Keep LiveKit API key/secret as before.
• If you prefer a generic HTTP adapter instead of Google, I can produce that adapter now so you can plug your provider’s endpoint and key.
Do you want the Google plugin example implemented fully (showing env vars and init), or a generic HTTP adapter you can fill with your STT/TTS provider details?
, with interactive elementsnumerous-lighter-25835
05/11/2026, 3:54 PMtall-airline-16756
05/11/2026, 3:55 PMlanguage="ur", so LiveKit can't create the STT provider instance.
Do this to fix it (keeps your code style):
1) Use Google Cloud STT (supports Urdu) as primary, keep Deepgram as fallback but without language="ur".
2) Provide Google credentials:
• GOOGLE_API_KEY for Gemini LLM.
• GOOGLE_APPLICATION_CREDENTIALS pointing to your service account JSON for Cloud STT/TTS.
3) Example replacement (minimal, matches your style — swap env vars as needed):
from livekit.plugins import google
from livekit import AgentSession, inference, stt, llm, tts
from livekit.turn_detection import MultilingualModel
session = AgentSession(
stt = stt.FallbackAdapter([
google.STT(model="cloud/speech-to-text", languages="ur"), # Google STT (Urdu)
inference.STT(model="deepgram/nova-3", language="multi"), # optional fallback (no explicit 'ur')
]),
llm = llm.FallbackAdapter([
inference.LLM.from_model_string("google/gemini-2.5-flash", api_key=GOOGLE_API_KEY),
inference.LLM.from_model_string("openai/gpt-4.1-mini"),
]),
tts = tts.FallbackAdapter([
google.TTS(language="ur-PK", voice_name="ur-PK-Standard-A"), # Google TTS (Urdu)
inference.TTS.from_model_string("inworld/inworld-tts-1"),
]),
turn_detection = MultilingualModel(),
vad = ctx.proc.userdata["vad"],
preemptive_generation = True,
)
If you prefer a generic HTTP adapter instead of Google (so you can plug another Urdu STT/TTS), I can provide concrete custom STT/TTS adapter classes you can drop into your session. Which do you want: Google plugin version fully wired (with env var examples) or generic HTTP adapters?
, with interactive elementsnumerous-lighter-25835
05/11/2026, 4:04 PMtall-airline-16756
05/11/2026, 4:04 PMfrom livekit.plugins import google
from livekit import AgentSession, inference, stt, llm, tts
from livekit.turn_detection import MultilingualModel
# env vars: GOOGLE_API_KEY, GOOGLE_APPLICATION_CREDENTIALS, LIVEKIT_API_KEY, LIVEKIT_API_SECRET
session = AgentSession(
stt = stt.FallbackAdapter([
google.STT(model="cloud/speech-to-text", languages="ur-PK"), # primary Urdu-Pakistani STT
inference.STT(model="deepgram/nova-3", language="multi"), # optional fallback (no explicit 'ur')
]),
llm = llm.FallbackAdapter([
inference.LLM.from_model_string("google/gemini-2.5-flash", api_key="YOUR_GOOGLE_API_KEY"),
inference.LLM.from_model_string("openai/gpt-4.1-mini"),
]),
tts = tts.FallbackAdapter([
google.TTS(language="ur-PK", voice_name="ur-PK-Standard-A"), # Urdu-Pakistani TTS
inference.TTS.from_model_string("inworld/inworld-tts-1"),
]),
turn_detection = MultilingualModel(),
vad = ctx.proc.userdata["vad"],
preemptive_generation = True,
)
Notes:
• The Deepgram model you used earlier rejects language="ur" — that caused the errors. Keep Deepgram as a fallback but do not set it to ur if it doesn’t support it.
• Ensure GOOGLE_APPLICATION_CREDENTIALS points to the service account JSON so Google STT/TTS can be created.
• Test with short Urdu-Pakistani phrases and check transcripts to confirm ur-PK behavior.
Want me to:
• Show the exact env var setup and startup commands, or
• Provide a generic HTTP adapter instead (if you have a non‑Google Urdu STT/TTS)?, with interactive elementsnumerous-lighter-25835
05/11/2026, 4:39 PMtall-airline-16756
05/11/2026, 4:40 PMur-PK-Standard-<X> and ur-PK-Wavenet-<X> (where X is a letter like A, B, ...). Confirm available voices in your project at: https://cloud.google.com/text-to-speech/docs/voices
Example AgentSession snippet using Google TTS voice names (your code style):
from livekit.plugins import google
from livekit import AgentSession, inference, stt, llm, tts
from livekit.turn_detection import MultilingualModel
session = AgentSession(
stt = stt.FallbackAdapter([
google.STT(model="cloud/speech-to-text", languages="ur-PK"),
inference.STT(model="deepgram/nova-3", language="multi"),
]),
llm = llm.FallbackAdapter([
inference.LLM.from_model_string("google/gemini-2.5-flash", api_key="YOUR_GOOGLE_API_KEY"),
inference.LLM.from_model_string("openai/gpt-4.1-mini"),
]),
tts = tts.FallbackAdapter([
google.TTS(language="ur-PK", voice_name="ur-PK-Standard-A"), # try Standard/Wavenet variants
inference.TTS.from_model_string("inworld/inworld-tts-1"),
]),
turn_detection = MultilingualModel(),
vad = ctx.proc.userdata["vad"],
preemptive_generation = True,
)
Notes:
• Replace voice_name with whichever ur-PK-Standard-* or ur-PK-Wavenet-* voices are listed for your Google Cloud project at the voices page.
• Ensure GOOGLE_APPLICATION_CREDENTIALS points to your service account JSON and GOOGLE_API_KEY is set for Gemini.
• If a specific ur-PK-<voice> name fails, check the Cloud TTS voices page for the exact available identifiers in your region/project.
Do you want me to:
• List exact voices from your Google project (I can show how to query them), or
• Try a recommended default like ur-PK-Standard-A and provide troubleshooting if it fails? Sources: Google Cloud TTS integration guide | LiveKit Documentation, with interactive elementsnumerous-lighter-25835
05/11/2026, 5:11 PMtall-airline-16756
05/11/2026, 5:12 PMfrom livekit.plugins import google
from livekit import AgentSession, inference, stt, llm, tts
from livekit.turn_detection import MultilingualModel
# Ensure env:
# GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
# GOOGLE_CLOUD_PROJECT=your-project-id
# GOOGLE_API_KEY=your-gemini-key
session = AgentSession(
stt = stt.FallbackAdapter([
google.STT(model="cloud/speech-to-text", languages="ur-PK"),
inference.STT(model="deepgram/nova-3", language="multi"),
]),
llm = llm.FallbackAdapter([
inference.LLM.from_model_string("google/gemini-2.5-flash", api_key="YOUR_GOOGLE_API_KEY"),
inference.LLM.from_model_string("openai/gpt-4.1-mini"),
]),
tts = tts.FallbackAdapter([
google.TTS(language="ur-PK", voice_name="ur-PK-Standard-A", project="your-project-id"),
inference.TTS.from_model_string("inworld/inworld-tts-1"),
]),
turn_detection = MultilingualModel(),
vad = ctx.proc.userdata["vad"],
preemptive_generation = True,
)
If you still see PermissionDenied after this:
• Confirm the service account belongs to the same project as GOOGLE_CLOUD_PROJECT.
• Confirm Text‑to‑Speech API is enabled for that project.
• Try adding project="your-project-id" to google.TTS() as in the snippet.
Would you like me to:
• Show the exact gcloud commands to create the service account and set roles, or
• Provide a tiny test script to verify Google TTS works outside LiveKit?, with interactive elementsnumerous-lighter-25835
05/11/2026, 5:13 PMtall-airline-16756
05/11/2026, 5:13 PMnumerous-lighter-25835
05/11/2026, 5:16 PMtall-airline-16756
05/11/2026, 5:16 PMgoogle.TTS(language="ur-PK", voice_name="ur-PK-Standard-A", project="your-project-id")
If you want, I can give:
• Exact gcloud commands to enable the API, create a service account, and set roles, or
• A minimal .env and startup snippet to test Google TTS in your environment.
Which would you like?
, with interactive elementsnumerous-lighter-25835
05/11/2026, 5:17 PMtall-airline-16756
05/11/2026, 5:18 PMnumerous-lighter-25835
05/13/2026, 7:30 PM