Skip to content

Commit

Permalink
update: add new event listener alias .on_realtime()
Browse files Browse the repository at this point in the history
  • Loading branch information
Maplemx committed Oct 9, 2024
1 parent 4fd918b commit 6da1764
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Agently/plugins/agent_component/EventListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def on_done(self, listener: callable, *, is_await:bool=False, is_agent_event:boo
def on_finally(self, listener: callable, *, is_await:bool=False, is_agent_event:bool=False):
self.add("response:finally", listener, is_await=is_await, is_agent_event=is_agent_event)
return self.agent

def on_realtime(self, listener: callable, *, is_await:bool=False, is_agent_event:bool=False):
self.add("response:realtime", listener, is_await=is_await, is_agent_event=is_agent_event)
return self.agent

async def call_event_listeners(self, event: str, data: any):
listeners = self.listeners.get_trace_back() or {}
Expand Down Expand Up @@ -65,6 +69,7 @@ def export(self):
"on_delta": { "func": self.on_delta },
"on_done": { "func": self.on_done },
"on_finally": { "func": self.on_finally },
"on_realtime": { "func": self.on_realtime },
"call_event_listeners": { "func": self.call_event_listeners },
},
}
Expand Down

0 comments on commit 6da1764

Please sign in to comment.