Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/tools/test_transcription_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,17 @@ def test_default_model_used_when_none(self, sample_ogg):

assert mock_groq.call_args[0][1] == DEFAULT_GROQ_STT_MODEL

def test_config_groq_model_used(self, sample_ogg):
config = {"groq": {"model": "whisper-large-v3"}}
with patch("tools.transcription_tools._load_stt_config", return_value=config), \
patch("tools.transcription_tools._get_provider", return_value="groq"), \
patch("tools.transcription_tools._transcribe_groq",
return_value={"success": True, "transcript": "hi"}) as mock_groq:
from tools.transcription_tools import transcribe_audio
transcribe_audio(sample_ogg, model=None)

assert mock_groq.call_args[0][1] == "whisper-large-v3"

def test_config_local_model_used(self, sample_ogg):
config = {"local": {"model": "small"}}
with patch("tools.transcription_tools._load_stt_config", return_value=config), \
Expand Down
3 changes: 2 additions & 1 deletion tools/transcription_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1671,7 +1671,8 @@ def transcribe_audio(file_path: str, model: Optional[str] = None) -> Dict[str, A
return _transcribe_local_command(file_path, model_name)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stt.groq: null is valid YAML and makes this expression return None, so the next groq_cfg.get(...) raises AttributeError. Please match the null-safe sibling-provider pattern introduced in 3a394210: stt_config.get("groq") or {}, with a regression test for the null subsection.

if provider == "groq":
model_name = model or DEFAULT_GROQ_STT_MODEL
groq_cfg = stt_config.get("groq", {})
model_name = model or groq_cfg.get("model", DEFAULT_GROQ_STT_MODEL)
return _transcribe_groq(file_path, model_name)

if provider == "openai":
Expand Down
Loading