From 653e9f0091a13a4d2ddfb64f3d1c7ee26d7c2009 Mon Sep 17 00:00:00 2001 From: EC <2340896+cyfyifanchen@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:36:18 +0800 Subject: [PATCH] Deepgram python 402 condition (#410) * docs: updating wording and adding new gif wording and new gif * docs: adding extensions image * docs: updating the wording. * docs: Fixing the link of FishAudio Fixing the link of FishAudio * feat: Adding Deepgram 402 condition --- .../extension/deepgram_asr_python/deepgram_wrapper.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/agents/ten_packages/extension/deepgram_asr_python/deepgram_wrapper.py b/agents/ten_packages/extension/deepgram_asr_python/deepgram_wrapper.py index fd74ae5d..bea05b71 100644 --- a/agents/ten_packages/extension/deepgram_asr_python/deepgram_wrapper.py +++ b/agents/ten_packages/extension/deepgram_asr_python/deepgram_wrapper.py @@ -80,8 +80,12 @@ async def on_error(self, error, **kwargs): interim_results=self.config.interim_results, punctuate=self.config.punctuate) # connect to websocket - if await self.deepgram_client.start(options) is False: - logger.error(f"failed to connect to deepgram") + result = await self.deepgram_client.start(options) + if result is False: + if self.deepgram_client.status_code == 402: + logger.error("Failed to connect to Deepgram - your account has run out of credits.") + else: + logger.error("Failed to connect to Deepgram") return logger.info(f"successfully connected to deepgram")