getting ' Turn detector does not support language ...
# ask-ai
a
getting ' Turn detector does not support language eng' when using Scribe as Transcription service.
t
Thanks for reaching out, Cesar. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I see you're hitting the error "Turn detector does not support language eng" when using ElevenLabs Scribe for transcription. This happens because Scribe returns a three-letter code (
eng
) but the LiveKit turn detector only accepts two-letter codes (e.g.,
en
). To fix it, force the STT language to the two-letter code in your configuration. Example (Python):
Copy code
from livekit.agents import AgentSession, inference
from livekit.plugins.turn_detector.multilingual import MultilingualModel

session = AgentSession(
    stt=inference.STT(
        model="elevenlabs/scribe_v2_realtime",
        language="en"  # use two-letter code
    ),
    turn_detection=MultilingualModel(),
    # ... other params
)
Try that and let me know if the error persists or which language you need so I can suggest the exact two-letter code. Sources: Rime TTS | LiveKit docs | ElevenLabs STT | LiveKit docs | LiveKit turn detector plugin | LiveKit docs
a
still happening.
t
Thanks — I’m sorry it’s still happening. I’m going to help diagnose why the turn detector is still seeing
eng
. Could you share: • The AgentSession/STT config code you’re using (the exact snippet where you create
inference.STT
and
AgentSession
). • A short sample of the transcription event or log that shows the language code (if available). • Which LiveKit agent/plugin versions you’re running (package names/versions). If you prefer, paste the minimal reproducible code that triggers the error and I’ll point out exactly where to map `eng`→`en` or adjust the config. Sources: LiveKit turn detector plugin | LiveKit docs | ElevenLabs TTS plugin guide | LiveKit docs | ElevenLabs STT | LiveKit docs
a
"language_code = "en" stt = elevenlabs.STT( api_key=os.getenv("ELEVEN_API_KEY"), language_code=language_code, ) # Create session with configuration session = AgentSession( stt=stt, " "DEBUG livekit.agents received user transcript {"user_transcript": "Hello?", "language": "eng", "transcript_delay": 0.8865277767181396, "pid": 48091, "job_id": "AJ_QKcB47Xh9Hy5", "room_id": "RM_F4fUY7p4X5ue"}"
t
Thanks — I can see you set
language_code = "en"
but the logs show the ElevenLabs STT is still emitting
"language": "eng"
. That confirms the turn detector is receiving
eng
and failing. Two practical fixes — pick whichever fits your setup: Option 1 — force the language at LiveKit Inference level (recommended if you use LiveKit agents) • Use
inference.STT
and set
language="en"
so the agent supplies
en
to downstream plugins:
Copy code
from livekit.agents import AgentSession, inference
from livekit.plugins.turn_detector.multilingual import MultilingualModel

stt = inference.STT(model="elevenlabs/scribe_v2_realtime", language="en")

session = AgentSession(
    stt=stt,
    turn_detection=MultilingualModel(),
    # ...
)
Option 2 — map the three-letter code to two-letter code in your transcription handler (works if you must keep using
elevenlabs.STT
) • Intercept transcription events and replace
"eng"
→
"en"
before passing to the turn detector:
Copy code
def handle_transcript(event):
    lang = event.get("language") or event.get("language_code")
    if lang == "eng":
        event["language"] = "en"
    # pass event into turn detector / AgentSession pipeline
Why this is needed: ElevenLabs Scribe returns a 3-letter code (
eng
) while the turn detector only accepts 2-letter ISO codes (
en
). If you want, paste the snippet where you forward STT results into the agent/turn detector and I’ll show the exact place to insert the mapping.
a
where do i put the handle_transcript function?
t
Good question — put the
handle_transcript
function where you receive/transmit STT events and before those events are handed to the turn detector or AgentSession pipeline. Two common approaches depending on how you integrate STT: Option A — register a transcript callback on the session (preferred if your setup supports session events) 1. Define the handler near your session setup. 2. Register it as the transcript event handler so every transcription event is normalized before processing. Example:
Copy code
def handle_transcript(event):
    lang = event.get("language") or event.get("language_code")
    if lang == "eng":
        event["language"] = "en"
    # forward normalized event to session processing
    session.process_transcript(event)

session = AgentSession(stt=stt, turn_detection=MultilingualModel(), ...)
session.on(event="transcript", handler=handle_transcript)
Option B — wrap/patch where you call the turn detector or feed transcripts into the agent If you manually call the turn detector or pass transcripts into the agent, call
handle_transcript
just before that call. Example:
Copy code
def handle_transcript(event):
    if event.get("language") == "eng":
        event["language"] = "en"
    return event

# when you get a raw transcript:
normalized = handle_transcript(raw_event)
agent.handle_transcript(normalized)  # or turn_detector.process(normalized)
If you share the portion of your code that currently forwards the ElevenLabs events into LiveKit (or the function you use to push transcripts into the agent), I’ll show the exact lines to insert the handler.