Follow pipecat's STT language conventions in Moonshine - #5182
Open
markbackman wants to merge 2 commits into
Open
Follow pipecat's STT language conventions in Moonshine#5182markbackman wants to merge 2 commits into
markbackman wants to merge 2 commits into
Conversation
Moonshine publishes one model per language, keyed by base ISO code. A pipecat Language resolves through language_to_moonshine_language(), so the base class stores the resolved code and the service reads it back -- the same path every other STT service takes. A language Moonshine has no model for raises with the supported set. Which architectures exist depends on the language: the streaming ones are published for English only, and most other languages ship a single model. An architecture unavailable for the configured language falls back to the best one published for it, so every supported language works with the default settings. Models are language-specific, so a language or model change reloads the model, keeping the loaded one if the reload fails.
Codecov Report❌ Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
Summary
MoonshineSTTServiceresolves languages throughlanguage_to_moonshine_language()and alanguage_to_service_language()override — the same path Whisper, FunASR, and AssemblyAI take, replacing an inline base-code split. Regional variants such asLanguage.ES_MXresolve to their base code, and a language Moonshine publishes no model for raises with the supported set.small-streamingdidn't exist for, say, Spanish and construction failed; an architecture unavailable for the configured language now falls back to the best model published for it.set_language()and settings updates reload the model rather than leaving it transcribing in the old language. A failed reload keeps the loaded model and pushes anErrorFrame.Model.BASE_STREAMINGno longer claims per-language availability that doesn't match what Moonshine publishes, the eight supported languages are named, and the non-commercial Community License covering the non-English models is called out.Testing
uv run pytest tests/test_moonshine_stt.py— the suite fakesmoonshine_voice, so it downloads no models. It covers defaults, regional-variant folding, the architecture fallback, the unsupported-language and unknown-model errors, both language maps,run_stt, reload-on-update, and reload failure.Loading a non-English model is exercised against the fake only; against the real library the English default and the unsupported-language path were checked directly.
🤖 Generated with Claude Code