Skip to content

Realtime - mismatching event type for audio transcript event #2698

@tbarbugli

Description

@tbarbugli

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

I receive an event with type response.audio_transcript.done but the ResponseAudioTranscriptDoneEvent type field expects the type to be set to response.output_audio_transcript.done.

# event_data is a dict 
if event_data.type == "response.audio_transcript.done":
   ResponseAudioTranscriptDoneEvent.model_validate(event)

Raises this exception:

pydantic_core._pydantic_core.ValidationError: 1 validation error for ResponseAudioTranscriptDoneEvent
type
  Input should be 'response.output_audio_transcript.done' [type=literal_error, input_value='response.audio_transcript.done', input_type=str]
    For further information visit https://errors.pydantic.dev/2.12/v/literal_error

Note: I am not 100% sure if this is a problem with the Python SDK or with the Realtime API (there is no response.audio_transcript.done in the documentation

To Reproduce

  1. Use the Realtime API
  2. Try to parse server events sent over data channel using pydantic model_validate
# event_data is a Python dict coming from the peerconnection data channel
if event_data.type == "response.audio_transcript.done":
   ResponseAudioTranscriptDoneEvent.model_validate(event)

Code snippets

OS

macOS

Python version

Python 3.12.9

Library version

2.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingopenapi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions