-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix: 11Labs Scribe v2 model not working with EOT prediction model #4601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ludobaka
wants to merge
9
commits into
livekit:main
Choose a base branch
from
Ludobaka:fix-broken-eot-for-elevenlabs-stt
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+119
−2
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3d38116
Some models can output eng instead of en, not supported by EOT model
Ludobaka 7bd4ac9
Fix missed normalized language assignment
Ludobaka 5d50b95
Revert changes on the audio recognition level
Ludobaka 8ce8c2e
Fix language normalization on Elevenlabs plugin
Ludobaka 71d3f98
Ruff format
Ludobaka 137382e
Fix typing
Ludobaka eb4c003
Handle case when provided code is None
Ludobaka 1f77143
Rework mapping as indicated by coderabbit
Ludobaka 92ea218
Map every supported 11Labs languages and refactor to a separate file
Ludobaka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/languages.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| """ | ||
| Mapping of ISO 639-3 language codes used by Scribe to ISO 639-1 | ||
| used by Livekit turn detector multilingual model | ||
| Note: ISO 639-3 language codes supported by Scribe but that have no ISO 639-1 code | ||
| are defined with a None mapping value | ||
| https://elevenlabs.io/docs/overview/capabilities/speech-to-text#supported-languages | ||
| """ | ||
|
|
||
| ISO_639_3_TO_1 = { | ||
| "afr": "af", | ||
| "amh": "am", | ||
| "ara": "ar", | ||
| "hye": "hy", | ||
| "asm": "as", | ||
| "ast": None, | ||
| "aze": "az", | ||
| "bel": "be", | ||
| "ben": "bn", | ||
| "bos": "bs", | ||
| "bul": "bg", | ||
| "mya": "my", | ||
| "yue": None, | ||
| "cat": "ca", | ||
| "ceb": None, | ||
| "nya": "ny", | ||
| "hrv": "hr", | ||
| "ces": "cs", | ||
| "dan": "da", | ||
| "nld": "nl", | ||
| "eng": "en", | ||
| "est": "et", | ||
| "fil": None, | ||
| "fin": "fi", | ||
| "fra": "fr", | ||
| "ful": "ff", | ||
| "glg": "gl", | ||
| "lug": "lg", | ||
| "kat": "ka", | ||
| "deu": "de", | ||
| "ell": "el", | ||
| "guj": "gu", | ||
| "hau": "ha", | ||
| "heb": "he", | ||
| "hin": "hi", | ||
| "hun": "hu", | ||
| "isl": "is", | ||
| "ibo": "ig", | ||
| "ind": "id", | ||
| "gle": "ga", | ||
| "ita": "it", | ||
| "jpn": "ja", | ||
| "jav": "jv", | ||
| "kea": None, | ||
| "kan": "kn", | ||
| "kaz": "kk", | ||
| "khm": "km", | ||
| "kor": "ko", | ||
| "kur": "ku", | ||
| "kir": "ky", | ||
| "lao": "lo", | ||
| "lav": "lv", | ||
| "lin": "ln", | ||
| "lit": "lt", | ||
| "luo": None, | ||
| "ltz": "lb", | ||
| "mkd": "mk", | ||
| "msa": "ms", | ||
| "mal": "ml", | ||
| "mlt": "mt", | ||
| "zho": "zh", | ||
| "mri": "mi", | ||
| "mar": "mr", | ||
| "mon": "mn", | ||
| "nep": "ne", | ||
| "nso": None, | ||
| "nor": "no", | ||
| "oci": "oc", | ||
| "ori": "or", | ||
| "pus": "ps", | ||
| "fas": "fa", | ||
| "pol": "pl", | ||
| "por": "pt", | ||
| "pan": "pa", | ||
| "ron": "ro", | ||
| "rus": "ru", | ||
| "srp": "sr", | ||
| "sna": "sn", | ||
| "snd": "sd", | ||
| "slk": "sk", | ||
| "slv": "sl", | ||
| "som": "so", | ||
| "spa": "es", | ||
| "swa": "sw", | ||
| "swe": "sv", | ||
| "tam": "ta", | ||
| "tgk": "tg", | ||
| "tel": "te", | ||
| "tha": "th", | ||
| "tur": "tr", | ||
| "ukr": "uk", | ||
| "umb": None, | ||
| "urd": "ur", | ||
| "uzb": "uz", | ||
| "vie": "vi", | ||
| "cym": "cy", | ||
| "wol": "wo", | ||
| "xho": "xh", | ||
| "zul": "zu", | ||
| } | ||
|
|
||
|
|
||
| def iso639_3_to_1(code: str | None) -> str | None: | ||
| """Convert ISO 639-3 to ISO 639-1. Returns None if no mapping exists.""" | ||
| return ISO_639_3_TO_1.get(code.lower()) if code else None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: livekit/agents
Length of output: 136
🏁 Script executed:
head -1 livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/stt.py | wc -l wc -l livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/stt.pyRepository: livekit/agents
Length of output: 140
🏁 Script executed:
sed -n '210,240p' livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/stt.pyRepository: livekit/agents
Length of output: 1055
🏁 Script executed:
sed -n '180,240p' livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/stt.pyRepository: livekit/agents
Length of output: 2548
🏁 Script executed:
Repository: livekit/agents
Length of output: 772
🏁 Script executed:
Repository: livekit/agents
Length of output: 441
🏁 Script executed:
sed -n '170,250p' livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/stt.pyRepository: livekit/agents
Length of output: 3237
🏁 Script executed:
sed -n '326,450p' livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/stt.pyRepository: livekit/agents
Length of output: 5154
🏁 Script executed:
sed -n '470,550p' livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/stt.pyRepository: livekit/agents
Length of output: 3746
🏁 Script executed:
grep -n "_process_stream_event" livekit-plugins/livekit-plugins-elevenlabs/livekit/plugins/elevenlabs/stt.pyRepository: livekit/agents
Length of output: 177
Guard against missing language_code in batch path.
If ElevenLabs omits
language_code,Nonewill propagate intoSpeechData.language(annotated asstr) and violate the type contract, potentially breaking downstream consumers. The streaming path has protection with a fallback chain (self._language or "en"), but the batch path lacks this. Consider aligning the batch path with the streaming pattern.🤖 Prompt for AI Agents