Skip to content

feat(voice): expose GA streamed transcription options - #4616

Open
abhay-codes07 wants to merge 3 commits into
openai:mainfrom
abhay-codes07:feat/stt-ga-transcription-options
Open

feat(voice): expose GA streamed transcription options#4616
abhay-codes07 wants to merge 3 commits into
openai:mainfrom
abhay-codes07:feat/stt-ga-transcription-options

Conversation

@abhay-codes07

@abhay-codes07 abhay-codes07 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

STTModelSettings exposes only a subset of the GA transcription options that the streamed STT session's wire schema (AudioTranscription in the Realtime session payload) accepts. This PR adds the three missing options and forwards them on the streamed path:

  • languages: possible languages of the input audio in ISO-639-1 format, supported by gpt-transcribe and gpt-live-transcribe. An explicit languages list takes precedence over the single language setting; when only language is set, the existing per-model spelling (languages: [language] for the gpt-transcribe family, language otherwise, per fix(voice): forward streamed STT language and prompt #4574) is unchanged.
  • keywords: words or phrases to guide transcription, supported by gpt-transcribe and gpt-live-transcribe.
  • delay: transcription latency/accuracy trade-off ("minimal" to "xhigh"), only supported with gpt-realtime-whisper.

Like turn_detection, the new fields apply to streamed sessions; each is sent only when set, so existing session payloads are byte-for-byte unchanged. Because gpt-realtime-whisper requires turn_detection: null, turn_detection now also accepts {"type": "none"} as an explicit disable marker (sent as null, mirroring the realtime module's None-disables contract); None keeps its released meaning of using the semantic_vad default. The transcription span's model_config records the new options alongside the existing ones. All three fields are optional and appended after the existing fields, so the released dataclass contract is unchanged (tests/test_released_api_contract.py passes unmodified).

Test plan

  • New tests in tests/voice/test_openai_stt_session_config.py:
    • languages takes precedence over language across gpt-4o-transcribe, gpt-transcribe, and gpt-live-transcribe.
    • keywords and delay are forwarded when set.
    • gpt-realtime-whisper + delay + turn_detection={"type": "none"} produces turn_detection: null in the session payload, and the default semantic_vad payload is unchanged.
    • With turn detection disabled, end of input commits the appended audio (input_audio_buffer.commit) so the turn is transcribed; the default-VAD path stays append-only and an audio-less stream commits nothing.
    • The existing omit-when-unset test's exact-equality assertion proves the new fields stay out of the payload by default.
  • All four new test variants fail on main without the source change.
  • uv run pytest tests/voice tests/test_released_api_contract.py: 316 passed.
  • Full test suite, uv run ruff format --check, and uv run mypy src pass locally (Windows). The verification stack could not complete cleanly because make lint (uv run ruff check) fails on current main with a pre-existing E501 in .agents/skills/implementation-final-review/scripts/test_skill_contract.py:48 (introduced by fe45b41, not touched by this PR); the files in this PR pass ruff check and ruff format --check.

Issue number

None.

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass
  • If using Codex, I've run /review before submitting this PR

Add languages, keywords, and delay to STTModelSettings and forward them
in the streamed STT session configuration. These GA transcription
options exist on the wire schema but had no SDK surface: languages and
keywords guide gpt-transcribe / gpt-live-transcribe, and delay controls
transcription latency for gpt-realtime-whisper.

An explicit languages list takes precedence over the single language
setting, which otherwise keeps its existing per-model spelling. The
transcription span's model_config records the new options alongside the
existing ones. All three fields are optional and appended after the
existing fields, so the released dataclass contract is unchanged.
Copilot AI lite review requested due to automatic review settings August 24, 2026 08:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8cf8824ae5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/voice/models/openai_stt.py
The delay option targets gpt-realtime-whisper, which requires
turn_detection: null in the session configuration, but None in
STTModelSettings.turn_detection falls back to the semantic_vad default
so null was unreachable. Accept {"type": "none"} as an explicit
disable marker, sent as null, mirroring the realtime module's
None-disables contract while keeping the released None-means-default
behavior. Cross-reference the requirement from the delay docstring.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebdc1010b3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/voice/models/openai_stt.py
With turn_detection: null the server never finalizes a turn on its own,
so a session that only appends audio ends without ever producing a
transcript. Send input_audio_buffer.commit for the appended audio when
the input stream ends and turn detection is disabled. Sessions with
server-side VAD are unchanged, and nothing is committed when no audio
was appended so an empty buffer cannot be finalized.
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.

2 participants