Skip to content

refactor(voice): introduce Transcriber interface for pluggable STT#353

Open
emadomedher wants to merge 1 commit intosipeed:mainfrom
emadomedher:feat/transcriber-interface
Open

refactor(voice): introduce Transcriber interface for pluggable STT#353
emadomedher wants to merge 1 commit intosipeed:mainfrom
emadomedher:feat/transcriber-interface

Conversation

@emadomedher
Copy link

Summary

Currently Discord, Slack, and Telegram all hardcode *voice.GroqTranscriber as their transcription dependency. This makes it impossible to swap in a different STT backend without modifying every channel file.

This PR adds a Transcriber interface to pkg/voice/transcriber.go and updates the three channels to depend on it instead of the concrete type.

Changes

  • pkg/voice/transcriber.go: add Transcriber interface (Transcribe + IsAvailable)
  • pkg/channels/discord.go: *voice.GroqTranscribervoice.Transcriber
  • pkg/channels/slack.go: same
  • pkg/channels/telegram.go: same

GroqTranscriber already satisfies the interface — zero behaviour change.

Why

This unblocks adding alternative STT providers (e.g. local Whisper — see follow-up PR) without touching channel code. It also aligns with how the Synthesizer interface works for TTS.

Tests

All existing tests pass (go test ./...).

Currently Discord, Slack, and Telegram all hardcode *voice.GroqTranscriber
as their transcription dependency. This makes it impossible to swap in a
different STT backend without changing each channel file.

Add a Transcriber interface to pkg/voice/transcriber.go:

  type Transcriber interface {
      Transcribe(ctx context.Context, audioFilePath string) (*TranscriptionResponse, error)
      IsAvailable() bool
  }

GroqTranscriber already implements this interface (no change to its
implementation). Update Discord, Slack, and Telegram to depend on the
interface instead of the concrete type.

No behaviour change — this is a pure refactor that enables future STT
providers (e.g. local Whisper) to be dropped in without modifying channel
code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant