From 2c933f43d854f5ef525bfcde32fe9b9d950e2133 Mon Sep 17 00:00:00 2001 From: Jon Taylor Date: Thu, 6 Jun 2024 23:00:51 +0200 Subject: [PATCH] linting errors and removed unusued sip url --- examples/dialin-chatbot/bot_daily.py | 16 +++++++--------- examples/dialin-chatbot/bot_runner.py | 2 +- examples/dialin-chatbot/bot_twilio.py | 8 ++++---- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/examples/dialin-chatbot/bot_daily.py b/examples/dialin-chatbot/bot_daily.py index a3ebd8de8..c17707fcb 100644 --- a/examples/dialin-chatbot/bot_daily.py +++ b/examples/dialin-chatbot/bot_daily.py @@ -24,19 +24,18 @@ load_dotenv(override=True) logger.remove(0) logger.add(sys.stderr, level="DEBUG") -daily_api_url = os.getenv("DAILY_API_URL", "https://api.daily.co/v1") daily_api_key = os.getenv("DAILY_API_KEY", "") +daily_api_url = os.getenv("DAILY_API_URL", "https://api.daily.co/v1") -async def main(room_url: str, token: str, callId: str, callDomain: str, sipUri: str): +async def main(room_url: str, token: str, callId: str, callDomain: str): async with aiohttp.ClientSession() as session: # diallin_settings are only needed if Daily's SIP URI is used # If you are handling this via Twilio, Telnyx, set this to None # and handle call-forwarding when on_dialin_ready fires. diallin_settings = DailyDialinSettings( call_id=callId, - call_domain=callDomain, - sip_uri=sipUri + call_domain=callDomain ) transport = DailyTransport( @@ -44,7 +43,7 @@ async def main(room_url: str, token: str, callId: str, callDomain: str, sipUri: token, "Chatbot", DailyParams( - api_url=f"{daily_api_url}", + api_url=f"https://{daily_api_url}", api_key=daily_api_key, dialin_settings=diallin_settings, audio_in_enabled=True, @@ -58,8 +57,8 @@ async def main(room_url: str, token: str, callId: str, callDomain: str, sipUri: tts = ElevenLabsTTSService( aiohttp_session=session, - api_key=os.getenv("ELEVENLABS_API_KEY"), - voice_id=os.getenv("ELEVENLABS_VOICE_ID"), + api_key=os.getenv("ELEVENLABS_API_KEY", ""), + voice_id=os.getenv("ELEVENLABS_VOICE_ID", ""), ) llm = OpenAILLMService( @@ -107,7 +106,6 @@ if __name__ == "__main__": parser.add_argument("-t", type=str, help="Token") parser.add_argument("-i", type=str, help="Call ID") parser.add_argument("-d", type=str, help="Call Domain") - parser.add_argument("-s", type=str, help="SIP URI") config = parser.parse_args() - asyncio.run(main(config.u, config.t, config.i, config.d, config.s)) + asyncio.run(main(config.u, config.t, config.i, config.d)) diff --git a/examples/dialin-chatbot/bot_runner.py b/examples/dialin-chatbot/bot_runner.py index f5c9ece5a..a87f9c15f 100644 --- a/examples/dialin-chatbot/bot_runner.py +++ b/examples/dialin-chatbot/bot_runner.py @@ -93,7 +93,7 @@ def _create_daily_room(room_url, callId, callDomain=None, vendor="daily"): # Note: this is mostly for demonstration purposes (refer to 'deployment' in docs) if vendor == "daily": bot_proc = f"python3 -m bot_daily -u {room.url} -t {token} -i { - callId} -d {callDomain} -s {room.config.sip_endpoint}" + callId} -d {callDomain}" else: bot_proc = f"python3 -m bot_twilio -u {room.url} -t { token} -i {callId} -s {room.config.sip_endpoint}" diff --git a/examples/dialin-chatbot/bot_twilio.py b/examples/dialin-chatbot/bot_twilio.py index 6f9556b0b..6ae8a24b3 100644 --- a/examples/dialin-chatbot/bot_twilio.py +++ b/examples/dialin-chatbot/bot_twilio.py @@ -32,7 +32,7 @@ twilio_account_sid = os.getenv('TWILIO_ACCOUNT_SID') twilio_auth_token = os.getenv('TWILIO_AUTH_TOKEN') twilioclient = Client(twilio_account_sid, twilio_auth_token) -daily_api_key = os.getenv("DAILY_API_KEY") +daily_api_key = os.getenv("DAILY_API_KEY", "") async def main(room_url: str, token: str, callId: str, sipUri: str): @@ -58,8 +58,8 @@ async def main(room_url: str, token: str, callId: str, sipUri: str): tts = ElevenLabsTTSService( aiohttp_session=session, - api_key=os.getenv("ELEVENLABS_API_KEY"), - voice_id=os.getenv("ELEVENLABS_VOICE_ID"), + api_key=os.getenv("ELEVENLABS_API_KEY", ""), + voice_id=os.getenv("ELEVENLABS_VOICE_ID", ""), ) llm = OpenAILLMService( @@ -108,7 +108,7 @@ async def main(room_url: str, token: str, callId: str, sipUri: str): twiml=f'{sipUri}' ) except Exception as e: - raise Exception(detail=f"Failed to forward call: {str(e)}") + raise Exception(f"Failed to forward call: {str(e)}") runner = PipelineRunner() await runner.run(task)