diff --git a/examples/foundational/02-llm-say-one-thing.py b/examples/foundational/02-llm-say-one-thing.py index f83862a41..a98815f1d 100644 --- a/examples/foundational/02-llm-say-one-thing.py +++ b/examples/foundational/02-llm-say-one-thing.py @@ -48,7 +48,7 @@ async def main(room_url): pipeline = Pipeline([llm, tts]) @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): await pipeline.queue_frames([LLMMessagesFrame(messages), EndFrame()]) await transport.run(pipeline) diff --git a/examples/foundational/03-still-frame.py b/examples/foundational/03-still-frame.py index c517fe6a9..5f6a6adc4 100644 --- a/examples/foundational/03-still-frame.py +++ b/examples/foundational/03-still-frame.py @@ -40,7 +40,7 @@ async def main(room_url): pipeline = Pipeline([imagegen]) @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): # Note that we do not put an EndFrame() item in the pipeline for this demo. # This means that the bot will stay in the channel until it times out. # An EndFrame() in the pipeline would cause the transport to shut diff --git a/examples/foundational/05a-local-sync-speech-and-text.py b/examples/foundational/05a-local-sync-speech-and-text.py index e19988a80..7083c367f 100644 --- a/examples/foundational/05a-local-sync-speech-and-text.py +++ b/examples/foundational/05a-local-sync-speech-and-text.py @@ -67,8 +67,7 @@ async def main(): return frame.text async def get_month_data(month): - messages = [{"role": "system", "content": f"Describe a nature photograph suitable for use in a calendar, for the month of { - month}. Include only the image description with no preamble. Limit the description to one sentence, please.", }] + messages = [{"role": "system", "content": f"Describe a nature photograph suitable for use in a calendar, for the month of {month}. Include only the image description with no preamble. Limit the description to one sentence, please.", }] messages_frame = LLMMessagesFrame(messages) diff --git a/examples/foundational/06-listen-and-respond.py b/examples/foundational/06-listen-and-respond.py index 93153ce84..3bd2a34f8 100644 --- a/examples/foundational/06-listen-and-respond.py +++ b/examples/foundational/06-listen-and-respond.py @@ -72,7 +72,7 @@ async def main(room_url: str, token): ) @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): # Kick off the conversation. messages.append( {"role": "system", "content": "Please introduce yourself to the user."}) diff --git a/examples/foundational/06a-image-sync.py b/examples/foundational/06a-image-sync.py index 3b25076ba..ad0b67d4f 100644 --- a/examples/foundational/06a-image-sync.py +++ b/examples/foundational/06a-image-sync.py @@ -85,7 +85,7 @@ async def main(room_url: str, token): pipeline = Pipeline([image_sync_aggregator, tma_in, llm, tma_out, tts]) @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): await pipeline.queue_frames([TextFrame("Hi, I'm listening!")]) await transport.run(pipeline) diff --git a/examples/foundational/07-interruptible.py b/examples/foundational/07-interruptible.py index 5da4fae16..69b7e7fae 100644 --- a/examples/foundational/07-interruptible.py +++ b/examples/foundational/07-interruptible.py @@ -50,7 +50,7 @@ async def main(room_url: str, token): pipeline = Pipeline([FrameLogger(), llm, FrameLogger(), tts]) @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): await transport.say("Hi, I'm listening!", tts) async def run_conversation(): diff --git a/examples/foundational/10-wake-word.py b/examples/foundational/10-wake-word.py index e07d40950..590b09a56 100644 --- a/examples/foundational/10-wake-word.py +++ b/examples/foundational/10-wake-word.py @@ -165,7 +165,7 @@ async def main(room_url: str, token): pipeline = Pipeline([isa, tf, ncf, tma_in, llm, tma_out, tts]) @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): await transport.say( "Hi! If you want to talk to me, just say 'hey Santa Cat'.", tts, diff --git a/examples/foundational/11-sound-effects.py b/examples/foundational/11-sound-effects.py index a6d36cd1c..68faa8a3a 100644 --- a/examples/foundational/11-sound-effects.py +++ b/examples/foundational/11-sound-effects.py @@ -114,7 +114,7 @@ async def main(room_url: str, token): pipeline = Pipeline([tma_in, in_sound, fl2, llm, tma_out, fl, tts, out_sound]) @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): await transport.say("Hi, I'm listening!", tts) await transport.send_queue.put(AudioFrame(sounds["ding1.wav"])) diff --git a/examples/internal/11a-dial-out.py b/examples/internal/11a-dial-out.py index 1e30d1803..98518f9eb 100644 --- a/examples/internal/11a-dial-out.py +++ b/examples/internal/11a-dial-out.py @@ -80,7 +80,7 @@ async def main(room_url: str, token, phone): tts = AzureTTSService() @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): await tts.say("Hi, I'm listening!", transport.send_queue) await transport.send_queue.put(AudioFrame(sounds["ding1.wav"])) diff --git a/examples/starter-apps/chatbot.py b/examples/starter-apps/chatbot.py index 666c624c2..79a28d88e 100644 --- a/examples/starter-apps/chatbot.py +++ b/examples/starter-apps/chatbot.py @@ -127,7 +127,7 @@ async def main(room_url: str, token): ] @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): print(f"!!! in here, pipeline.source is {pipeline.source}") await pipeline.queue_frames([LLMMessagesFrame(messages)]) diff --git a/examples/starter-apps/patient-intake.py b/examples/starter-apps/patient-intake.py index 553aacde5..f00d06b0d 100644 --- a/examples/starter-apps/patient-intake.py +++ b/examples/starter-apps/patient-intake.py @@ -330,7 +330,7 @@ async def main(room_url: str, token): pipeline = Pipeline(processors=[fl, llm, fl2, checklist, tts]) @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): await pipeline.queue_frames([OpenAILLMContextFrame(context)]) async def handle_intake(): diff --git a/examples/starter-apps/storybot.py b/examples/starter-apps/storybot.py index f7bb15971..73102657a 100644 --- a/examples/starter-apps/storybot.py +++ b/examples/starter-apps/storybot.py @@ -232,7 +232,7 @@ async def main(room_url: str, token): start_story_event = asyncio.Event() @transport.event_handler("on_first_other_participant_joined") - async def on_first_other_participant_joined(transport): + async def on_first_other_participant_joined(transport, participant): start_story_event.set() async def storytime(): diff --git a/src/dailyai/transports/daily_transport.py b/src/dailyai/transports/daily_transport.py index 6f4479f0c..3a77dc534 100644 --- a/src/dailyai/transports/daily_transport.py +++ b/src/dailyai/transports/daily_transport.py @@ -255,7 +255,7 @@ class DailyTransport(ThreadedTransport, EventHandler): self.client.leave() self.client.release() - def on_first_other_participant_joined(self): + def on_first_other_participant_joined(self, participant): pass def call_joined(self, join_data, client_error): @@ -277,7 +277,7 @@ class DailyTransport(ThreadedTransport, EventHandler): def on_participant_joined(self, participant): if not self._other_participant_has_joined and participant["id"] != self._my_participant_id: self._other_participant_has_joined = True - self.on_first_other_participant_joined() + self.on_first_other_participant_joined(participant) def on_participant_left(self, participant, reason): if len(self.client.participants()) < self._min_others_count + 1: @@ -286,7 +286,6 @@ class DailyTransport(ThreadedTransport, EventHandler): def on_app_message(self, message: Any, sender: str): if self._loop: frame = ReceivedAppMessageFrame(message, sender) - print(frame) asyncio.run_coroutine_threadsafe( self.receive_queue.put(frame), self._loop ) diff --git a/tests/test_daily_transport_service.py b/tests/test_daily_transport_service.py index 8c632cb61..b620acf75 100644 --- a/tests/test_daily_transport_service.py +++ b/tests/test_daily_transport_service.py @@ -11,11 +11,11 @@ class TestDailyTransport(unittest.IsolatedAsyncioTestCase): was_called = False @transport.event_handler("on_first_other_participant_joined") - def test_event_handler(transport): + def test_event_handler(transport, participant): nonlocal was_called was_called = True - transport.on_first_other_participant_joined() + transport.on_first_other_participant_joined({"id": "user-id"}) self.assertTrue(was_called) @@ -29,7 +29,7 @@ class TestDailyTransport(unittest.IsolatedAsyncioTestCase): event = asyncio.Event() @transport.event_handler("on_first_other_participant_joined") - async def test_event_handler(transport): + async def test_event_handler(transport, participant): nonlocal event print("sleeping") await asyncio.sleep(0.1)