|
4 | 4 | # SPDX-License-Identifier: BSD 2-Clause License |
5 | 5 | # |
6 | 6 |
|
7 | | -import argparse |
8 | 7 | import os |
9 | 8 |
|
10 | 9 | from dotenv import load_dotenv |
|
18 | 17 | from pipecat.pipeline.runner import PipelineRunner |
19 | 18 | from pipecat.pipeline.task import PipelineParams, PipelineTask |
20 | 19 | from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext |
| 20 | +from pipecat.runner.types import RunnerArguments |
| 21 | +from pipecat.runner.utils import create_transport |
21 | 22 | from pipecat.services.cartesia.tts import CartesiaTTSService |
22 | 23 | from pipecat.services.deepgram.stt import DeepgramSTTService |
23 | 24 | from pipecat.services.llm_service import FunctionCallParams |
@@ -74,7 +75,7 @@ async def fetch_weather_from_api(params: FunctionCallParams): |
74 | 75 | } |
75 | 76 |
|
76 | 77 |
|
77 | | -async def run_example(transport: BaseTransport, _: argparse.Namespace, handle_sigint: bool): |
| 78 | +async def run_bot(transport: BaseTransport): |
78 | 79 | logger.info(f"Starting bot") |
79 | 80 |
|
80 | 81 | stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY")) |
@@ -158,12 +159,18 @@ async def on_client_disconnected(transport, client): |
158 | 159 | logger.info(f"Client disconnected") |
159 | 160 | await task.cancel() |
160 | 161 |
|
161 | | - runner = PipelineRunner(handle_sigint=handle_sigint) |
| 162 | + runner = PipelineRunner(handle_sigint=False) |
162 | 163 |
|
163 | 164 | await runner.run(task) |
164 | 165 |
|
165 | 166 |
|
| 167 | +async def bot(runner_args: RunnerArguments): |
| 168 | + """Main bot entry point compatible with Pipecat Cloud.""" |
| 169 | + transport = await create_transport(runner_args, transport_params) |
| 170 | + await run_bot(transport) |
| 171 | + |
| 172 | + |
166 | 173 | if __name__ == "__main__": |
167 | | - from pipecat.examples.run import main |
| 174 | + from pipecat.runner.run import main |
168 | 175 |
|
169 | | - main(run_example, transport_params=transport_params) |
| 176 | + main() |
0 commit comments