OpenAIRealtimeWebRTCClient
autogen.agentchat.realtime.experimental.clients.oai.OpenAIRealtimeWebRTCClient #
Bases: RealtimeClientBase
(Experimental) Client for OpenAI Realtime API that uses WebRTC protocol.
(Experimental) Client for OpenAI Realtime API.
PARAMETER | DESCRIPTION |
---|---|
llm_config | The config for the client. |
websocket | the websocket to use for the connection TYPE: |
logger | the logger to use for logging events |
Source code in autogen/agentchat/realtime/experimental/clients/oai/rtc_client.py
add_event async
#
get_event async
#
queue_input_audio_buffer_delta async
#
queue InputAudioBufferDelta.
PARAMETER | DESCRIPTION |
---|---|
audio | The audio. TYPE: |
Source code in autogen/agentchat/realtime/experimental/clients/realtime_client.py
send_function_result async
#
Send the result of a function call to the OpenAI Realtime API.
PARAMETER | DESCRIPTION |
---|---|
call_id | The ID of the function call. TYPE: |
result | The result of the function call. TYPE: |
Source code in autogen/agentchat/realtime/experimental/clients/oai/rtc_client.py
send_text async
#
Send a text message to the OpenAI Realtime API.
PARAMETER | DESCRIPTION |
---|---|
role | The role of the message. TYPE: |
text | The text of the message. TYPE: |
Source code in autogen/agentchat/realtime/experimental/clients/oai/rtc_client.py
send_audio async
#
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.
PARAMETER | DESCRIPTION |
---|---|
audio | The audio to send. TYPE: |
Source code in autogen/agentchat/realtime/experimental/clients/oai/rtc_client.py
truncate_audio async
#
Truncate audio in the OpenAI Realtime API.
PARAMETER | DESCRIPTION |
---|---|
audio_end_ms | The end of the audio to truncate. TYPE: |
content_index | The index of the content to truncate. TYPE: |
item_id | The ID of the item to truncate. TYPE: |
Source code in autogen/agentchat/realtime/experimental/clients/oai/rtc_client.py
session_update async
#
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
PARAMETER | DESCRIPTION |
---|---|
session_options | The session options to update. |
Source code in autogen/agentchat/realtime/experimental/clients/oai/rtc_client.py
session_init_data #
Control initial session with OpenAI.
Source code in autogen/agentchat/realtime/experimental/clients/oai/rtc_client.py
connect async
#
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
Source code in autogen/agentchat/realtime/experimental/clients/oai/rtc_client.py
read_events async
#
Read events from the OpenAI Realtime API.
get_factory classmethod
#
Create a Realtime API client.
PARAMETER | DESCRIPTION |
---|---|
llm_config | The config for the client. |
logger | The logger to use for logging events. TYPE: |
**kwargs | Additional arguments. TYPE: |
RETURNS | DESCRIPTION |
---|---|
RealtimeClientProtocol | The Realtime API client is returned if the model matches the pattern TYPE: |