Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/engineering/speech_io.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ hints, not required output or tool instructions. Transcription uses one audio
model call and no semantic rewriting pass. `gpt-transcribe` receives plural
`languages`/`keywords`; the GPT-4o audio models receive the compatible prompt
and singular language parameter.
Browser locales such as `en-NZ` are reduced to the primary language code `en`
for either provider API; the response retains the original locale hint. A live
DGX request on 10 September rejected `languages=["en-NZ"]` with HTTP 400 but
accepted the otherwise identical `languages=["en"]` request and correctly
transcribed the synthetic fixture's Von, Vontology and Wikidata vocabulary.

## Playback repair

Expand Down Expand Up @@ -106,6 +111,11 @@ or live DGX acceptance. The DGX transcript was read through its own canonical
history service after temporarily reconnecting this Mac's existing Tailscale
profile. Its observed pre-repair runtime was `12ae94c0`. Runtime deployment and
physical iOS/Android behaviour require separate verification receipts.
The merged repair was subsequently deployed to the DGX as `702530d9`; the
runtime, served asset and authenticated browser build were read back. An
operator-scoped synthetic-audio replay exposed the locale incompatibility above,
which requires the accompanying provider-language correction. This does not
establish physical-device microphone or autoplay behaviour.

Provider reference: [OpenAI file transcription](https://developers.openai.com/api/docs/guides/speech-to-text).
Browser reference: [MDN SpeechRecognition](https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition).
4 changes: 3 additions & 1 deletion src/backend/services/speech_transcription_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ def transcribe_audio(
if model == "gpt-transcribe":
options["extra_body"] = {
"keywords": terms,
**({"languages": [language]} if language else {}),
# The provider accepts language codes, not browser locales: a live
# en-NZ request is rejected while the otherwise identical en works.
**({"languages": [language.split("-", 1)[0].lower()]} if language else {}),
}
elif language:
options["language"] = language.split("-", 1)[0].lower()
Expand Down
3 changes: 2 additions & 1 deletion tests/backend/test_speech_transcription.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ def test_recorded_audio_carries_vocabulary_and_language(provider, mime, extensio
assert args["file"][0] == "dictation." + extension
assert args["extra_body"] == {
"keywords": ["Vontology", "Wikidata"],
"languages": ["en-NZ"],
"languages": ["en"],
}
assert "Discuss Vontology" in args["prompt"]
assert result["text"] == "Von uses Vontology."
assert result["language_hint"] == "en-NZ"
gate.assert_called_once_with(
provider="openai",
model="gpt-transcribe",
Expand Down
Loading