From d8f30b1df7d58a68d722ede84bde60352a655c75 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Wed, 22 Jul 2026 17:47:04 -0500 Subject: [PATCH] fix(stt): flag empty transcripts as no_speech An STT provider that hears no words is reporting silence, not failing. ElevenLabs/xAI empty-transcript errors now carry no_speech so live voice loops can re-listen quietly instead of surfacing an error on every pause. --- tests/tools/test_transcription_tools.py | 2 ++ tools/transcription_tools.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/tools/test_transcription_tools.py b/tests/tools/test_transcription_tools.py index 434971e9aac4b..0997872c69fdf 100644 --- a/tests/tools/test_transcription_tools.py +++ b/tests/tools/test_transcription_tools.py @@ -1209,6 +1209,7 @@ class TestTranscribeXAI: assert result["success"] is False assert "empty transcript" in result["error"] + assert result["no_speech"] is True # live voice loops treat this as silence def test_permission_error(self, monkeypatch, sample_ogg, mock_xai_http_module): monkeypatch.setenv("XAI_API_KEY", "xai-test-key") @@ -1453,6 +1454,7 @@ class TestTranscribeElevenLabs: assert result["success"] is False assert "empty transcript" in result["error"] + assert result["no_speech"] is True # live voice loops treat this as silence # ============================================================================ diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py index 39e92261a19cf..fd351c710710b 100644 --- a/tools/transcription_tools.py +++ b/tools/transcription_tools.py @@ -1546,6 +1546,7 @@ def _transcribe_xai(file_path: str, model_name: str) -> Dict[str, Any]: "success": False, "transcript": "", "error": "xAI STT returned empty transcript", + "no_speech": True, } logger.info( @@ -1633,6 +1634,7 @@ def _transcribe_elevenlabs(file_path: str, model_name: str) -> Dict[str, Any]: "success": False, "transcript": "", "error": "ElevenLabs STT returned empty transcript", + "no_speech": True, } logger.info(