Skip to main content

OpenAIRealtimeWebRTCClient

(Experimental) Client for OpenAI Realtime API that uses WebRTC protocol.
(Experimental) Client for OpenAI Realtime API.
Parameters:

Static Methods

get_factory

Create a Realtime API client.
Parameters: Returns:

Instance Attributes

logger


Get the logger for the OpenAI Realtime API.

Instance Methods

connect

Connect to the OpenAI Realtime API.
In the case of WebRTC, we pass connection information over the websocket, so that javascript on the other end of websocket open actual connection to OpenAI

read_events

Read events from the OpenAI Realtime API.

send_audio

Send audio to the OpenAI Realtime API.
in case of WebRTC, audio is already sent by js client, so we just queue it in order to be logged.
Parameters:

send_function_result

Send the result of a function call to the OpenAI Realtime API.
Parameters:

send_text

Send a text message to the OpenAI Realtime API.
Parameters:

session_init_data

Control initial session with OpenAI.

session_update

Send a session update to the OpenAI Realtime API.
In the case of WebRTC we can not send it directly, but we can send it to the javascript over the websocket, and rely on it to send session update to OpenAI
Parameters:

truncate_audio

Truncate audio in the OpenAI Realtime API.
Parameters: