Skip to content

Pre-connect Realtime manager.send crashes on Omit in dict events #3402

@KirtiRamchandani

Description

@KirtiRamchandani

AsyncRealtimeConnectionManager.send() / RealtimeConnectionManager.send() call json.dumps(event) on dict payloads, but post-connect connection.send() uses maybe_transform() which strips Omit/NotGiven.

Repro:

manager = client.realtime.connect(model="gpt-4o-realtime-preview")
manager.send({"type": "response.cancel", "event_id": omit})
# TypeError: Object of type Omit is not JSON serializable

PR incoming with regression test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions