fix: ElevenLabs language mapping — fetch /v1/models for full language coverage#52
Merged
Merged
Conversation
…erage (#51) - Add _getVoicesWithModels() helper that fetches /v1/models in parallel with /v1/voices and resolves each voice's supported languages from its high_quality_base_model_ids - Deduplicate languages across multiple models per voice - Fall back to English for voices with no model associations - Update _mapVoicesToUnified to use resolved languages instead of labels.accent (which was a non-BCP-47 accent string, not a language code)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #51
Problem
_mapVoicesToUnifiedusedvoice.labels?.accent(e.g."american","british") as thebcp47language code. These are accent strings, not BCP-47 codes, so the language filter never matched anything. Additionally, multilingual voices (v2, turbo, flash) support 30+ languages but were only tagged with a single accent.Fix
Fetch
/v1/modelsin parallel with/v1/voices. Each model exposes alanguages: [{ language_id, name }]array. Cross-reference each voice'shigh_quality_base_model_idswith the model map to build the full union of supported languages, deduplicated.language_id("en","es") used asbcp47name("English","Spanish") used asdisplay[{ bcp47: "en", ... }]can_do_text_to_speech: falseare excludedTest plan
__tests__/elevenlabs-language-mapping.test.ts— all passnpm run build— clean