fix(voice/stt): accept conversation.item.input_audio_transcription.completed (keep legacy alias) #1537
+28
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates event handling in
OpenAISTTTranscriptionSession
to support both legacy"input_audio_transcription_completed"
and the currently observed"conversation.item.input_audio_transcription.completed"
events when streaming transcription over the WebSocket endpoint (wss://api.openai.com/v1/realtime?intent=transcription).The test suite (
tests/voice/test_openai_stt.py
) is also updated to cover both event types, ensuring that the transcription output is properly yielded from either event in real scenarios.Motivation
In my environment, events retrieved from
event = await asyncio.wait_for(self._event_queue.get(), timeout=EVENT_INACTIVITY_TIMEOUT)
correspond to those emitted by the OpenAI WebSocket session.The observed event for completed transcription is currently
"conversation.item.input_audio_transcription.completed"
, not the legacy event name.These changes allow realtime STT workflows to work as expected, without manual hotfixes.
Testing
Bottom: After adding support for
conversation.item.input_audio_transcription.completed
.Tests pass successfully in my local environment
dudududukim/OpenAI_agent_practice
The updated test confirms correct behavior for both event types.