Skip to content

Remove dead Speechmatics and Soniox STT code from backend #6116

Closed

Description

@beastoin

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 by get_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

  1. backend/utils/stt/streaming.py — Remove process_audio_soniox() (505-677), process_audio_speechmatics() (680-793), Soniox language map (42-104), Speechmatics in STTService enum
  2. backend/routers/transcribe.py — Remove soniox/speechmatics conditional branches (~6 blocks), dead imports
  3. backend/utils/stt/soniox_util.py — Delete entire file
  4. backend/utils/webhooks.py — Remove speechmatics duplicate implementation
  5. backend/database/redis_db.py — Remove set/get/remove_user_soniox_speech_profile (298-307)
  6. backend/database/conversations.py — Keep soniox/speechmatics collection reads for backward compat with historical data
  7. backend/routers/speech_profile.py — Remove soniox profile deletion call
  8. backend/scripts/stt/i_soniox_profiles.py — Delete script
  9. backend/requirements.txt — Remove soniox==1.10.1, speechmatics-python==2.0.1

Acceptance Criteria

  • Only Deepgram STT code paths remain in streaming.py and transcribe.py
  • STTService enum only has deepgram
  • 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

Activity

  1. added 14 commits that reference this issue on Mar 28, 2026
    20f422a
    fc5fb8f
    ecd92ab
    522aab4
    cbf12c4
    17871d5
    3e57125
    de5605a
    ce027de
    b2dda19
    50163c9
    c8de931
    6132eb2
    e81a3ea
  2. 55 remaining items

  3. added 15 commits that reference this issue on Apr 28, 2026
    d6bbcc0
    fdd88a4
    cacd5e8
    3fcb720
    88a801c
    aa649e5
    6e2c633
    b1ab275
    9fd3940
    4e8e04f
    2af88d7
    dd82259
    a0f1344
    1ae2868
    401c906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions