experimental
autogen.agentchat.realtime.experimental.FunctionObserver
FunctionObserver
Observer for handling function calls from the OpenAI Realtime API.
Observer for handling function calls from the OpenAI Realtime API.
Name | Description |
---|---|
logger | Type: ForwardRef(‘Logger’) | None Default: None |
Instance Methods
call_function
Call a function registered with the agent.
Name | Description |
---|---|
call_id | The ID of the function call. Type: str |
name | The name of the function to call. Type: str |
kwargs | The arguments to pass to the function. Type: dict[str, typing.Any] |
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.
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 observer loop.
wait_for_ready
Get the event that is set when the observer is ready.