Update examples with review feedback
This commit is contained in:
@@ -105,6 +105,8 @@ async def run_bot(transport: BaseTransport):
|
|||||||
async def bot(runner_args: RunnerArguments):
|
async def bot(runner_args: RunnerArguments):
|
||||||
"""Main bot entry point compatible with Pipecat Cloud."""
|
"""Main bot entry point compatible with Pipecat Cloud."""
|
||||||
|
|
||||||
|
transport = None
|
||||||
|
|
||||||
if isinstance(runner_args, DailyRunnerArguments):
|
if isinstance(runner_args, DailyRunnerArguments):
|
||||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||||
|
|
||||||
@@ -199,6 +201,13 @@ async def bot(runner_args: RunnerArguments):
|
|||||||
serializer=serializer,
|
serializer=serializer,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
logger.error(f"Unsupported runner arguments type: {type(runner_args)}")
|
||||||
|
return
|
||||||
|
|
||||||
|
if transport is None:
|
||||||
|
logger.error("Failed to create transport")
|
||||||
|
return
|
||||||
|
|
||||||
await run_bot(transport)
|
await run_bot(transport)
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,18 @@
|
|||||||
|
|
||||||
"""Pipecat Cloud-compatible bot example.
|
"""Pipecat Cloud-compatible bot example.
|
||||||
|
|
||||||
Transports are Daily or SmallWebRTC."""
|
Transports are Daily or SmallWebRTC.
|
||||||
|
|
||||||
|
Run it with:
|
||||||
|
|
||||||
|
- WebRTC transport::
|
||||||
|
|
||||||
|
python 02-two-transport-bot.py
|
||||||
|
|
||||||
|
- Daily transport::
|
||||||
|
|
||||||
|
python 02-two-transport-bot.py --transport daily
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -93,6 +104,8 @@ async def run_bot(transport: BaseTransport):
|
|||||||
async def bot(runner_args: RunnerArguments):
|
async def bot(runner_args: RunnerArguments):
|
||||||
"""Main bot entry point compatible with Pipecat Cloud."""
|
"""Main bot entry point compatible with Pipecat Cloud."""
|
||||||
|
|
||||||
|
transport = None
|
||||||
|
|
||||||
if isinstance(runner_args, DailyRunnerArguments):
|
if isinstance(runner_args, DailyRunnerArguments):
|
||||||
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
from pipecat.transports.services.daily import DailyParams, DailyTransport
|
||||||
|
|
||||||
@@ -127,6 +140,13 @@ async def bot(runner_args: RunnerArguments):
|
|||||||
),
|
),
|
||||||
webrtc_connection=runner_args.webrtc_connection,
|
webrtc_connection=runner_args.webrtc_connection,
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
logger.error(f"Unsupported runner arguments type: {type(runner_args)}")
|
||||||
|
return
|
||||||
|
|
||||||
|
if transport is None:
|
||||||
|
logger.error("Failed to create transport")
|
||||||
|
return
|
||||||
|
|
||||||
await run_bot(transport)
|
await run_bot(transport)
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,14 @@
|
|||||||
# SPDX-License-Identifier: BSD 2-Clause License
|
# SPDX-License-Identifier: BSD 2-Clause License
|
||||||
#
|
#
|
||||||
|
|
||||||
"""Pipecat Cloud-compatible bot example.
|
"""Pipecat development runner example.
|
||||||
|
|
||||||
Transports are Daily or SmallWebRTC."""
|
This example has a single transport—SmallWebRTCTransport.
|
||||||
|
|
||||||
|
Run it with::
|
||||||
|
|
||||||
|
python 03-single-transport-bot.py
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user