RealtimeAgent
. Demo implementation.WebSocketAudioAdapter
, a simple way to stream real-time audio using WebSockets. While effective, WebSockets can face challenges with quality and reliability in high-latency or network-variable scenarios. Enter WebRTC.
Today, we’re excited to showcase the integration with OpenAI Realtime API with WebRTC, leveraging WebRTC’s peer-to-peer communication capabilities to provide a robust, low-latency, high-quality audio streaming experience directly from the browser.
<audio>
element.DataChannel
is established to send and receive events (e.g., function calls).OAI_CONFIG_LIST
file based on the provided OAI_CONFIG_LIST_sample
:
OAI_CONFIG_LIST
file, update the api_key
with your OpenAI API key.
chat.html
page and provides the port number in the template, which is used for WebSockets connections.
RealtimeAgent
that will manage interactions with OpenAI’s Realtime API. It also includes logging for monitoring the process.
RealtimeAgent
. It responds with a simple weather message based on the input city.
RealtimeAgent
to start handling the WebSocket interactions.