Repository navigation
Closed
Description
Problem
The backend transcription pipeline currently uses Deepgram exclusively (dg-nova-3 default via STT_SERVICE_MODELS env var), but still contains dead code for two former STT providers:
- Speechmatics — full streaming implementation (
streaming.py:680-793), never selected byget_stt_service_for_language() - Soniox — full streaming implementation (
streaming.py:505-677), speech profile utils (soniox_util.py), Redis cache functions (redis_db.py:298-307), management scripts (scripts/stt/i_soniox_profiles.py)
Both providers are unreachable in production. The dead code adds maintenance burden, confusing conditional branches in the transcription WebSocket handler, and unnecessary pip dependencies.
Current State
| Provider | Status | Lines of dead code | Dependencies |
|---|---|---|---|
| Deepgram | ACTIVE (sole provider) | — | deepgram-sdk==4.8.1 |
| Soniox | DEAD — never selected | ~250 lines across 6 files | soniox==1.10.1 |
| Speechmatics | DEAD — never selected | ~150 lines across 4 files | speechmatics-python==2.0.1 |
Why the code is dead
get_stt_service_for_language() in streaming.py:200-227 loops through STT_SERVICE_MODELS (default: dg-nova-3). Only soniox-stt-rt, dg-nova-3, dg-nova-2 are recognized model strings. Speechmatics has no model string — it can never be selected. Soniox would require manually setting STT_SERVICE_MODELS=soniox-stt-rt which is not done in any deployment.
Files to clean up
backend/utils/stt/streaming.py— Removeprocess_audio_soniox()(505-677),process_audio_speechmatics()(680-793), Soniox language map (42-104), Speechmatics inSTTServiceenumbackend/routers/transcribe.py— Remove soniox/speechmatics conditional branches (~6 blocks), dead importsbackend/utils/stt/soniox_util.py— Delete entire filebackend/utils/webhooks.py— Remove speechmatics duplicate implementationbackend/database/redis_db.py— Removeset/get/remove_user_soniox_speech_profile(298-307)backend/database/conversations.py— Keep soniox/speechmatics collection reads for backward compat with historical databackend/routers/speech_profile.py— Remove soniox profile deletion callbackend/scripts/stt/i_soniox_profiles.py— Delete scriptbackend/requirements.txt— Removesoniox==1.10.1,speechmatics-python==2.0.1
Acceptance Criteria
- Only Deepgram STT code paths remain in
streaming.pyandtranscribe.py -
STTServiceenum only hasdeepgram - Soniox/Speechmatics pip dependencies removed from
requirements.txt - Dead utility files (
soniox_util.py,i_soniox_profiles.py) deleted - Dead Redis functions removed
- Historical data access preserved (keep collection readers in
conversations.py) - All existing tests pass
- Backend starts and serves transcription requests correctly
Metadata
Metadata
Assignees
Labels
No labels
Activity
refactor(stt): remove i_soniox_profiles.py — dead Soniox profile script
refactor(stt): remove Soniox/Speechmatics from streaming.py
refactor(stt): remove Soniox/Speechmatics from transcribe.py
refactor(stt): remove Soniox speech profile cleanup from speech_profi…
refactor(stt): remove Soniox speech profile Redis helpers
refactor(stt): remove dead websocket webhook and unused import from w…
refactor(stt): remove soniox and speechmatics-python from requirement…
refactor(stt): remove Soniox/Speechmatics from benchmark comparison s…
test(stt): remove soniox_util mock from streaming backoff test
test(stt): remove soniox mock from LLM usage test, fix missing stub
test(stt): update fair use guard point count after removing providers
test(stt): update DG usage batch test to expect 2 accumulation points
test(stt): update fair use accumulation assertion from >=4 to >=2
refactor(stt): remove SONIOX_API_KEY from .env.template
55 remaining items
test(stt): update fair use accumulation assertion from >=4 to >=2
refactor(stt): remove SONIOX_API_KEY from .env.template
refactor(stt): remove SONIOX_API_KEY from dev backend-listen Helm values
refactor(stt): remove SONIOX_API_KEY from prod backend-listen Helm va…
refactor(stt): remove SONIOX_API_KEY from dev pusher Helm values
refactor(stt): remove SONIOX_API_KEY from prod pusher Helm values
refactor(stt): remove SONIOX_API_KEY from dev backend-secrets Helm va…
refactor(stt): remove SONIOX_API_KEY from prod backend-secrets Helm v…
refactor(stt): update stale Speechmatics comment in transcript_segmen…
refactor(stt): update stale Soniox reference in safe_socket.py docstring
docs(stt): update backend deepdive to reflect Deepgram-only STT
docs(stt): update transcription docs to reflect Deepgram-only STT
refactor(stt): rename Speechmatics-specific comment to generic
docs(stt): fix remaining multi-provider reference in backend deepdive…
docs(stt): fix stale multi-provider fallback references in transcript…