fix: bypass LanguageCode normalization that maps cmn back to zh
LiveKit's LanguageCode class normalizes ISO 639-3 codes to ISO 639-1 (cmn → zh), but Speechmatics API expects "cmn" not "zh". Override the internal _stt_options.language after construction. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7292ac6ca6
commit
9daf0e3b4f
|
|
@ -40,5 +40,9 @@ def create_speechmatics_stt(language: str = "cmn") -> speechmatics.STT:
|
||||||
language=sm_lang,
|
language=sm_lang,
|
||||||
include_partials=True,
|
include_partials=True,
|
||||||
)
|
)
|
||||||
|
# Workaround: LiveKit's LanguageCode normalizes ISO 639-3 "cmn" back to
|
||||||
|
# ISO 639-1 "zh", but Speechmatics expects "cmn". Override the internal
|
||||||
|
# option after construction so the raw Speechmatics code is sent.
|
||||||
|
stt._stt_options.language = sm_lang # type: ignore[assignment]
|
||||||
logger.info("Speechmatics STT created: language=%s (input=%s)", sm_lang, language)
|
logger.info("Speechmatics STT created: language=%s (input=%s)", sm_lang, language)
|
||||||
return stt
|
return stt
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue