big-postman-34034
05/12/2026, 1:45 PMtall-airline-16756
05/12/2026, 1:45 PMtall-airline-16756
05/12/2026, 1:46 PMLanguageCode from `livekit.agents`:
from livekit.agents import LanguageCode
• In Node.js there isn’t a LanguageCode export; use normalizeLanguage() from @livekit/agents instead:
import { normalizeLanguage } from '@livekit/agents';
`LanguageCode`/`normalizeLanguage()` accepts common formats (ISO 639-1, BCP-47, ISO 639-3, names, underscored variants) and normalizes them to BCP-47.
Sources: Speech-to-text (STT) models overview | LiveKit Documentation, with interactive elementsbig-postman-34034
05/12/2026, 1:47 PMlanguage required in SpeechData object initialization?tall-airline-16756
05/12/2026, 1:48 PMSpeechData initialization code you're using or the package/version so I can confirm whether language is required?
, with interactive elementsbig-postman-34034
05/12/2026, 1:48 PMtall-airline-16756
05/12/2026, 1:48 PMlanguage is required in SpeechData for Python:
• No, you do not need to set language when initializing SpeechData.
• language is populated by STT providers when they return language-detection results (e.g., Deepgram with detect_language=True, Soniox with enable_language_identification=True). It’s a read-only output, not an input you must provide.
If you want, tell me which STT provider and example code you’re using and I can show how to enable language detection and where the detected language appears in the SpeechEvent output.
Sources: Speech-to-text (STT) models overview | LiveKit Documentation | Text-to-speech (TTS) models overview | LiveKit Documentation | AssemblyAI STT | LiveKit Documentation | Smallest AI STT plugin guide | LiveKit Documentation | Soniox STT plugin guide | LiveKit Documentation, with interactive elementsbig-postman-34034
05/12/2026, 1:49 PMtall-airline-16756
05/12/2026, 1:49 PMSpeechData class requires a language positional argument when you instantiate it. Even though STT providers populate language for events, if you create a SpeechData instance yourself you must pass language.
What you can do:
• Import LanguageCode and pass a value when constructing:
from livekit.agents import LanguageCode
sd = SpeechData(
LanguageCode("en-US"),
text="hello",
start_time=0.0,
end_time=1.0,
)
• If you don't know the language (e.g., you want a placeholder until detection runs), pass a sensible default like "und" or "en-US" depending on your flow:
sd = SpeechData(LanguageCode("und"), text="...", ...)
If you share the code where you create SpeechData, I can suggest the exact minimal change to satisfy Pylance/mypy.
, with interactive elements