TwilioAudioAdapter
autogen.agentchat.realtime.experimental.TwilioAudioAdapter #
Bases: RealtimeObserver
Adapter for streaming audio from Twilio to OpenAI Realtime API and vice versa.
Adapter for streaming audio from Twilio to OpenAI Realtime API and vice versa.
| PARAMETER | DESCRIPTION |
|---|---|
websocket | the websocket connection to the Twilio service TYPE: |
logger | the logger to use for logging events |
Source code in autogen/agentchat/realtime/experimental/audio_adapters/twilio_audio_adapter.py
run async #
Run the observer with the agent.
When implementing, be sure to call self._ready_event.set() when the observer is ready to process events.
| PARAMETER | DESCRIPTION |
|---|---|
agent | The realtime agent attached to the observer. TYPE: |
Source code in autogen/agentchat/realtime/experimental/realtime_observer.py
wait_for_ready async #
on_close async #
on_event async #
Receive events from the OpenAI Realtime API, send audio back to Twilio.
Source code in autogen/agentchat/realtime/experimental/audio_adapters/twilio_audio_adapter.py
handle_speech_started_event async #
Handle interruption when the caller's speech starts.
Source code in autogen/agentchat/realtime/experimental/audio_adapters/twilio_audio_adapter.py
send_mark async #
Send a mark of audio interruption to the Twilio websocket.
Source code in autogen/agentchat/realtime/experimental/audio_adapters/twilio_audio_adapter.py
run_loop async #
Run the adapter loop.
Source code in autogen/agentchat/realtime/experimental/audio_adapters/twilio_audio_adapter.py
initialize_session async #
Control initial session with OpenAI.