Skip to content

Follow pipecat's STT language conventions in Moonshine - #5182

Open
markbackman wants to merge 2 commits into
mainfrom
mb/moonshine-stt-lang
Open

Follow pipecat's STT language conventions in Moonshine#5182
markbackman wants to merge 2 commits into
mainfrom
mb/moonshine-stt-lang

Conversation

@markbackman

@markbackman markbackman commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • MoonshineSTTService resolves languages through language_to_moonshine_language() and a language_to_service_language() override — the same path Whisper, FunASR, and AssemblyAI take, replacing an inline base-code split. Regional variants such as Language.ES_MX resolve to their base code, and a language Moonshine publishes no model for raises with the supported set.
  • Non-English languages work with the default settings. Moonshine publishes its streaming architectures for English only, so the default small-streaming didn'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 an ErrorFrame.
  • Docs: Model.BASE_STREAMING no 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 fakes moonshine_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

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

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.50000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pipecat/services/moonshine/stt.py 97.50% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/pipecat/services/moonshine/stt.py 98.00% <97.50%> (+71.13%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant