examples: allow setting custom program arguments

This commit is contained in:
Aleix Conchillo Flaqué
2025-04-23 15:38:07 -07:00
parent 4ee6c4b59e
commit a753a623d4
106 changed files with 223 additions and 125 deletions

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
import aiohttp import aiohttp
@@ -22,7 +23,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Create a transport using the WebRTC connection # Create a transport using the WebRTC connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
import aiohttp import aiohttp
@@ -22,7 +23,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Create a transport using the WebRTC connection # Create a transport using the WebRTC connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -21,7 +22,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Create a transport using the WebRTC connection # Create a transport using the WebRTC connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -21,7 +22,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Create a transport using the WebRTC connection # Create a transport using the WebRTC connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -22,7 +23,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Create a transport using the WebRTC connection # Create a transport using the WebRTC connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
import aiohttp import aiohttp
@@ -22,7 +23,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Create a transport using the WebRTC connection # Create a transport using the WebRTC connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -21,7 +22,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Create a transport using the WebRTC connection # Create a transport using the WebRTC connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dataclasses import dataclass from dataclasses import dataclass
@@ -63,7 +64,7 @@ class MonthPrepender(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
"""Run the Calendar Month Narration bot using WebRTC transport. """Run the Calendar Month Narration bot using WebRTC transport.
Args: Args:

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -52,7 +53,7 @@ class MetricsLogger(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -67,7 +68,7 @@ class ImageSyncAggregator(FrameProcessor):
await self.push_frame(frame) await self.push_frame(frame)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -42,7 +43,7 @@ def get_session_history(session_id: str) -> BaseChatMessageHistory:
return message_store[session_id] return message_store[session_id]
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from deepgram import LiveOptions from deepgram import LiveOptions
@@ -30,7 +31,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
import aiohttp import aiohttp
@@ -25,7 +26,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -25,7 +26,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
import time import time
@@ -25,7 +26,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
import aiohttp import aiohttp
@@ -25,7 +26,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -26,7 +27,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -25,7 +26,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -25,7 +26,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
import aiohttp import aiohttp
@@ -25,7 +26,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dataclasses import dataclass from dataclasses import dataclass
@@ -190,7 +191,7 @@ class TanscriptionContextFixup(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -35,7 +36,7 @@ ultravox_processor = UltravoxSTTService(
) )
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
from dotenv import load_dotenv from dotenv import load_dotenv
from loguru import logger from loguru import logger
@@ -46,7 +47,7 @@ class MirrorProcessor(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import asyncio import asyncio
import tkinter as tk import tkinter as tk
@@ -49,7 +50,7 @@ class MirrorProcessor(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
p2p_transport = SmallWebRTCTransport( p2p_transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -26,7 +27,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
import wave import wave
@@ -77,7 +78,7 @@ class InboundSoundEffectWrapper(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from typing import Optional from typing import Optional
@@ -46,7 +47,7 @@ class UserImageRequester(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
# Get WebRTC peer connection ID # Get WebRTC peer connection ID
webrtc_peer_id = webrtc_connection.pc_id webrtc_peer_id = webrtc_connection.pc_id

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from typing import Optional from typing import Optional
@@ -46,7 +47,7 @@ class UserImageRequester(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
# Get WebRTC peer connection ID # Get WebRTC peer connection ID
webrtc_peer_id = webrtc_connection.pc_id webrtc_peer_id = webrtc_connection.pc_id

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from typing import Optional from typing import Optional
@@ -46,7 +47,7 @@ class UserImageRequester(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
# Get WebRTC peer connection ID # Get WebRTC peer connection ID
webrtc_peer_id = webrtc_connection.pc_id webrtc_peer_id = webrtc_connection.pc_id

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from typing import Optional from typing import Optional
@@ -46,7 +47,7 @@ class UserImageRequester(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
# Get WebRTC peer connection ID # Get WebRTC peer connection ID
webrtc_peer_id = webrtc_connection.pc_id webrtc_peer_id = webrtc_connection.pc_id

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
from dotenv import load_dotenv from dotenv import load_dotenv
from loguru import logger from loguru import logger
@@ -30,7 +31,7 @@ class TranscriptionLogger(FrameProcessor):
print(f"Transcription: {frame.text}") print(f"Transcription: {frame.text}")
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -31,7 +31,7 @@ class TranscriptionLogger(FrameProcessor):
print(f"Transcription: {frame.text}") print(f"Transcription: {frame.text}")
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -30,7 +31,7 @@ class TranscriptionLogger(FrameProcessor):
print(f"Transcription: {frame.text}") print(f"Transcription: {frame.text}")
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -30,7 +31,7 @@ class TranscriptionLogger(FrameProcessor):
print(f"Transcription: {frame.text}") print(f"Transcription: {frame.text}")
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import time import time
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -52,7 +52,7 @@ class TranscriptionLogger(FrameProcessor):
self._last_transcription_time = time.time() self._last_transcription_time = time.time()
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -31,7 +32,7 @@ async def get_weather(function_name, tool_call_id, arguments, llm, context, resu
await result_callback(f"The weather in {location} is currently 72 degrees and sunny.") await result_callback(f"The weather in {location} is currently 72 degrees and sunny.")
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import asyncio import asyncio
import os import os
@@ -57,7 +58,7 @@ async def get_image(function_name, tool_call_id, arguments, llm, context, result
) )
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
global webrtc_peer_id global webrtc_peer_id
webrtc_peer_id = webrtc_connection.pc_id webrtc_peer_id = webrtc_connection.pc_id

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import asyncio import asyncio
import os import os
@@ -57,7 +58,7 @@ async def get_image(function_name, tool_call_id, arguments, llm, context, result
) )
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
global webrtc_peer_id global webrtc_peer_id
webrtc_peer_id = webrtc_connection.pc_id webrtc_peer_id = webrtc_connection.pc_id

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import asyncio import asyncio
import os import os
@@ -59,7 +60,7 @@ async def get_image(function_name, tool_call_id, arguments, llm, context, result
) )
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
global webrtc_peer_id global webrtc_peer_id
webrtc_peer_id = webrtc_connection.pc_id webrtc_peer_id = webrtc_connection.pc_id

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -30,7 +31,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -11,6 +11,7 @@ currently support function calling. The example shows basic chat completion func
using Perplexity's API while maintaining compatibility with the OpenAI interface. using Perplexity's API while maintaining compatibility with the OpenAI interface.
""" """
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -31,7 +32,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -32,7 +33,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -52,7 +53,7 @@ async def barbershop_man_filter(frame) -> bool:
return current_voice == "Barbershop Man" return current_voice == "Barbershop Man"
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from deepgram import LiveOptions from deepgram import LiveOptions
@@ -45,7 +46,7 @@ async def spanish_filter(frame) -> bool:
return current_language == "Spanish" return current_language == "Spanish"
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -25,7 +26,7 @@ from pipecat.transports.services.daily import DailyTransportMessageFrame
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -26,7 +27,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -20,26 +20,13 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
# Parse command line arguments async def run_bot(webrtc_connection: SmallWebRTCConnection, args: argparse.Namespace):
# This will be used to pass the input video file to the bot
# You can run the bot with a command like:
# python 18-gstreamer-filesrc.py -i path/to/video.mp4
def parse_arguments():
parser = argparse.ArgumentParser(description="Daily AI SDK Bot Sample")
parser.add_argument("-i", "--input", type=str, required=True, help="Input video file")
return parser.parse_args()
args = parse_arguments()
async def run_bot(webrtc_connection: SmallWebRTCConnection):
logger.info(f"Starting bot with video input: {args.input}") logger.info(f"Starting bot with video input: {args.input}")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(
webrtc_connection=webrtc_connection, webrtc_connection=webrtc_connection,
params=TransportParams( params=TransportParams(
audio_in_enabled=True, audio_out_enabled=True,
video_out_enabled=True, video_out_enabled=True,
video_out_is_live=True, video_out_is_live=True,
video_out_width=1280, video_out_width=1280,
@@ -72,4 +59,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
if __name__ == "__main__": if __name__ == "__main__":
from run import main from run import main
main() parser = argparse.ArgumentParser(description="Pipecat Bot Runner")
parser.add_argument("-i", "--input", type=str, required=True, help="Input video file")
main(parser)

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
from dotenv import load_dotenv from dotenv import load_dotenv
from loguru import logger from loguru import logger
@@ -19,7 +20,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot with video test source") logger.info(f"Starting bot with video test source")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from datetime import datetime from datetime import datetime
@@ -65,7 +66,7 @@ weather_function = FunctionSchema(
tools = ToolsSchema(standard_tools=[weather_function]) tools = ToolsSchema(standard_tools=[weather_function])
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from datetime import datetime from datetime import datetime
@@ -64,7 +65,7 @@ weather_function = FunctionSchema(
tools = ToolsSchema(standard_tools=[weather_function]) tools = ToolsSchema(standard_tools=[weather_function])
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import glob import glob
import json import json
import os import os
@@ -162,7 +163,7 @@ tools = [
] ]
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
global tts global tts

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import asyncio import asyncio
import glob import glob
import json import json
@@ -164,7 +165,7 @@ tools = [
] ]
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import glob import glob
import json import json
import os import os
@@ -157,7 +158,7 @@ tools = [
] ]
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
global tts global tts

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import glob import glob
import json import json
import os import os
@@ -221,7 +222,7 @@ tools = [
] ]
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
global tts, webrtc_peer_id global tts, webrtc_peer_id
webrtc_peer_id = webrtc_connection.pc_id webrtc_peer_id = webrtc_connection.pc_id

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -31,7 +32,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import asyncio import asyncio
import os import os
import time import time
@@ -200,7 +201,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import asyncio import asyncio
import os import os
import time import time
@@ -404,7 +405,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import asyncio import asyncio
import os import os
import time import time
@@ -626,7 +627,7 @@ class OutputGate(FrameProcessor):
break break
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -14,6 +14,7 @@ Example:
INPUT_AUDIO_PATH=my_audio.mp3 python 23-bot-background-sound.py INPUT_AUDIO_PATH=my_audio.mp3 python 23-bot-background-sound.py
""" """
import argparse
import asyncio import asyncio
import os import os
@@ -41,7 +42,7 @@ if not audio_path:
raise ValueError("No INPUT_AUDIO_PATH specified in environment variables") raise ValueError("No INPUT_AUDIO_PATH specified in environment variables")
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
soundfile_mixer = SoundfileMixer( soundfile_mixer = SoundfileMixer(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import asyncio import asyncio
import os import os
@@ -36,7 +37,7 @@ async def fetch_weather_from_api(function_name, tool_call_id, args, llm, context
await result_callback({"conditions": "nice", "temperature": "75"}) await result_callback({"conditions": "nice", "temperature": "75"})
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dataclasses import dataclass from dataclasses import dataclass
@@ -268,7 +269,7 @@ class TranscriptionContextFixup(FrameProcessor):
await self.push_frame(frame, direction) await self.push_frame(frame, direction)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -24,7 +25,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Initialize the SmallWebRTCTransport with the connection # Initialize the SmallWebRTCTransport with the connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -23,7 +24,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Initialize the SmallWebRTCTransport with the connection # Initialize the SmallWebRTCTransport with the connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from datetime import datetime from datetime import datetime
@@ -46,7 +47,7 @@ for the weather, call this function.
""" """
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Initialize the SmallWebRTCTransport with the connection # Initialize the SmallWebRTCTransport with the connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -39,7 +40,7 @@ Respond to what the user said in a creative and helpful way. Keep your responses
""" """
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Initialize the SmallWebRTCTransport with the connection # Initialize the SmallWebRTCTransport with the connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -40,7 +41,7 @@ Start each interaction by asking the user about which place they would like to k
""" """
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
# Initialize the SmallWebRTCTransport with the connection # Initialize the SmallWebRTCTransport with the connection

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -26,7 +27,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
load_dotenv(override=True) load_dotenv(override=True)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from typing import List, Optional from typing import List, Optional
@@ -88,7 +89,7 @@ class TranscriptHandler:
await self.save_message(msg) await self.save_message(msg)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@@ -67,7 +68,7 @@ class DebugObserver(BaseObserver):
logger.info(f"🤖 BOT STOP SPEAKING: {src} {arrow} {dst} at {time_sec:.2f}s") logger.info(f"🤖 BOT STOP SPEAKING: {src} {arrow} {dst} at {time_sec:.2f}s")
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -4,6 +4,7 @@
# SPDX-License-Identifier: BSD 2-Clause License # SPDX-License-Identifier: BSD 2-Clause License
# #
import argparse
import os import os
import sys import sys
from pathlib import Path from pathlib import Path
@@ -59,7 +60,7 @@ class LLMSearchLoggerProcessor(FrameProcessor):
await self.push_frame(frame) await self.push_frame(frame)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -47,6 +47,7 @@ Customization options:
- change the function calling logic - change the function calling logic
""" """
import argparse
import json import json
import os import os
import time import time
@@ -152,7 +153,7 @@ async def query_knowledge_base(
await result_callback(response.text) await result_callback(response.text)
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

View File

@@ -46,6 +46,7 @@ Note:
handling merged and separate audio tracks respectively. handling merged and separate audio tracks respectively.
""" """
import argparse
import datetime import datetime
import io import io
import os import os
@@ -85,7 +86,7 @@ async def save_audio_file(audio: bytes, filename: str, sample_rate: int, num_cha
logger.info(f"Audio saved to {filename}") logger.info(f"Audio saved to {filename}")
async def run_bot(webrtc_connection: SmallWebRTCConnection): async def run_bot(webrtc_connection: SmallWebRTCConnection, _: argparse.Namespace):
logger.info(f"Starting bot") logger.info(f"Starting bot")
transport = SmallWebRTCTransport( transport = SmallWebRTCTransport(

Some files were not shown because too many files have changed in this diff Show More