Skip to content

feat(stt): add VOICEMODE_STT_TRANSLATE for translate-to-English STT - #601

Open
sanketpatel32 wants to merge 1 commit into
mbailey:masterfrom
sanketpatel32:issue-240-whisper-translate
Open

sanketpatel32 wants to merge 1 commit into
mbailey:masterfrom
sanketpatel32:issue-240-whisper-translate

Conversation

@sanketpatel32

Copy link
Copy Markdown

Fixes #240.

What

Adds VOICEMODE_STT_TRANSLATE (default false). When true, simple_stt_failover calls each endpoint's /v1/audio/translations instead of /v1/audio/transcriptions, so speech in any language comes back as English text — Whisper's translate-to-English task, exactly the use case in #240 (speak Greek, Claude reads English).

# In voicemode.env
VOICEMODE_STT_TRANSLATE=true

Details

  • Naming: follows the VOICEMODE_STT_* family for request-level STT options (VOICEMODE_STT_PROMPT, VOICEMODE_STT_TIMEOUT, VOICEMODE_STT_COMPRESS); the VOICEMODE_WHISPER_* family configures the local whisper.cpp service itself.
  • language is never sent while translate is on: the translations API has no language parameter (source language auto-detected, output always English), so VOICEMODE_WHISPER_LANGUAGE — explicit or auto — is left out of the request. prompt (VOICEMODE_STT_PROMPT) is still forwarded, since translations accepts it.
  • Unchanged machinery: the per-endpoint failover chain, the local transient-retry loop (VM-926), and failure classification (VM-2342) all behave exactly as before; they just call audio.translations.create instead of audio.transcriptions.create.
  • Honest error reporting: attempted_endpoints and OpenAI error parsing now record the path that was actually called (/audio/translations or /audio/transcriptions). An endpoint that doesn't serve translations fails like any other STT error and the chain fails over.

Docs

  • docs/reference/environment.md: new STT table row + a paragraph on behaviour and the dropped language parameter.
  • docs/guides/configuration.md: VOICEMODE_STT_TRANSLATE in the STT example block.
  • voice_mode/resources/docs/parameters.md: new "Translated Speech (STT Translate)" section.
  • voice_mode/resources/configuration.py: listed in voice://config/env-vars; commented sample in the default voicemode.env header in config.py.
  • CHANGELOG: entry under ## [Unreleased] → Added (Support translation endpoint for non-English speech → English output #240).

Tests

New tests/test_stt_translate.py (11 tests): translations endpoint used when on; language omitted for auto/de/el; prompt/model/response_format still forwarded; transient retry, next-endpoint failover, and endpoint-path reporting all still work; default path untouched. All pass, plus the 72 existing STT failover tests (test_stt_language_auto_fallback, test_stt_error_handling, test_stt_retry, test_stt_timeout, test_stt_failover_wire_model) with no regressions.

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

…bailey#240)

Call each STT endpoint's /v1/audio/translations instead of
/v1/audio/transcriptions when VOICEMODE_STT_TRANSLATE=true, so speech
in any language comes back as English text (Whisper's
translate-to-English task). The translations API has no language
parameter -- the source language is auto-detected -- so
VOICEMODE_WHISPER_LANGUAGE is not sent while the setting is on.

Failover, the local transient-retry loop, and error classification are
unchanged; failure entries and OpenAI error parsing now name whichever
audio path was called. An endpoint that does not serve translations
fails like any other STT error and the chain fails over.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

Support translation endpoint for non-English speech → English output

1 participant