experimental
autogen.agentchat.realtime.experimental.RealtimeObserver
RealtimeObserver
Observer for the OpenAI Realtime API.
Observer for the OpenAI Realtime API.
Name | Description |
---|---|
logger | Type: logging.Logger | None Default: None |
Instance Attributes
agent
logger
realtime_client
Instance Methods
initialize_session
Initialize the session for the observer.
on_close
Handle close of RealtimeClient.
on_event
Handle an event from the OpenAI Realtime API.
Name | Description |
---|---|
event | The event from the OpenAI Realtime API. Type: RealtimeEvent |
run
Run the observer with the agent.
When implementing, be sure to call self._ready_event.set()
when the observer is ready to process events.
Name | Description |
---|---|
agent | The realtime agent attached to the observer. Type: RealtimeAgent |
run_loop
Run the loop if needed.
This method is called after the observer is ready to process events.
Events will be processed by the on_event method, this is just a hook for additional processing.
Use initialize_session to set up the session.
wait_for_ready
Get the event that is set when the observer is ready.