34 lines
1.4 KiB
Python
34 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"
|