diff --git a/api/services/pipecat/event_handlers.py b/api/services/pipecat/event_handlers.py index c2804c2..6a654ee 100644 --- a/api/services/pipecat/event_handlers.py +++ b/api/services/pipecat/event_handlers.py @@ -51,7 +51,6 @@ def register_transport_event_handlers( async def on_client_connected(transport, participant): logger.debug("In on_client_connected callback handler - initializing workflow") await audio_buffer.start_recording() - await engine.initialize() @transport.event_handler("on_client_disconnected") async def on_client_disconnected(transport, participant): diff --git a/api/services/pipecat/run_pipeline.py b/api/services/pipecat/run_pipeline.py index 4d725a9..a516de0 100644 --- a/api/services/pipecat/run_pipeline.py +++ b/api/services/pipecat/run_pipeline.py @@ -567,6 +567,9 @@ async def _run_pipeline( # Now set the task on the engine engine.set_task(task) + + # Initialize the engine to set the initial context + await engine.initialize() # Register event handlers in_memory_audio_buffer, in_memory_transcript_buffer = (