example: pass RunnerArguments to run_bot()

This lets us get handle_sigint from RunnerArguments which knows where the
application is running and if SIGINT/SIGTERM should be handled or not.
This commit is contained in:
Aleix Conchillo Flaqué
2025-08-05 14:01:54 -07:00
parent 21e4f0d56d
commit 66ad29b2b1
140 changed files with 420 additions and 420 deletions

View File

@@ -88,7 +88,7 @@ transport_params = {
}
async def run_bot(transport: BaseTransport):
async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
logger.info(f"Starting bot")
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
@@ -210,7 +210,7 @@ indicate you should use the get_image tool are:
logger.info(f"Client disconnected")
await task.cancel()
runner = PipelineRunner(handle_sigint=False)
runner = PipelineRunner(handle_sigint=runner_args.handle_sigint)
await runner.run(task)
@@ -218,7 +218,7 @@ indicate you should use the get_image tool are:
async def bot(runner_args: RunnerArguments):
"""Main bot entry point compatible with Pipecat Cloud."""
transport = await create_transport(runner_args, transport_params)
await run_bot(transport)
await run_bot(transport, runner_args)
if __name__ == "__main__":