Skip to main content

FunctionObserver

Observer for handling function calls from the OpenAI Realtime API.
Observer for handling function calls from the OpenAI Realtime API.
Parameters:

Instance Methods

call_function

Call a function registered with the agent.
Parameters:

initialize_session

Add registered tools to OpenAI with a session update.

on_close

Handle close of RealtimeClient.

on_event

Handle function call events from the OpenAI Realtime API.
Parameters:

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.
Parameters:

run_loop

Run the observer loop.

wait_for_ready

Get the event that is set when the observer is ready.