hermes-agent/tests/tools/test_stt_default_language.py
Teknium bc997a36a8 feat(stt): default global stt.language to 'en'
Whisper auto-detection frequently misidentifies short/accented clips,
which users experience as voice notes transcribed in the wrong language
(Teknium + CTO both hit this). The unified resolver from #73067 made a
global hint possible; this makes it the DEFAULT so stock installs stop
guessing. Non-English users set stt.language once; '' restores
auto-detect for multilingual use.

Deep-merge gives existing configs the new default automatically (no
_config_version bump needed); any explicit per-provider or global
language setting still wins.
2026-07-27 21:26:20 -07:00

33 lines
1.4 KiB
Python

"""Default STT language contract.
Teknium (July 2026): the global ``stt.language`` DEFAULTS to "en" because
Whisper auto-detection frequently misidentifies short/accented clips
("STT transcribed the wrong language" class). Users opt back into
auto-detect with ``stt.language: ""``.
"""
from hermes_cli.config import DEFAULT_CONFIG
from tools.transcription_tools import _resolve_stt_language
class TestDefaultSttLanguage:
def test_default_config_pins_english(self):
assert DEFAULT_CONFIG["stt"]["language"] == "en"
def test_default_config_resolves_en_for_every_provider(self, monkeypatch):
monkeypatch.delenv("HERMES_LOCAL_STT_LANGUAGE", raising=False)
stt = DEFAULT_CONFIG["stt"]
for provider in ("local", "groq", "openai", "mistral", "xai", "elevenlabs", "deepinfra"):
assert _resolve_stt_language(provider, stt) == "en", provider
def test_blank_global_restores_auto_detect(self, monkeypatch):
monkeypatch.delenv("HERMES_LOCAL_STT_LANGUAGE", raising=False)
stt = dict(DEFAULT_CONFIG["stt"])
stt["language"] = ""
assert _resolve_stt_language("groq", stt) is None
def test_per_provider_still_wins_over_default(self, monkeypatch):
monkeypatch.delenv("HERMES_LOCAL_STT_LANGUAGE", raising=False)
stt = dict(DEFAULT_CONFIG["stt"])
stt["groq"] = {"language": "he"}
assert _resolve_stt_language("groq", stt) == "he"