From aedba59c6e3c8503f2eb7b48fee91a95a4128cd4 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 3 Sep 2024 08:59:58 -0700 Subject: [PATCH] feat: add error handling for transcription in Voice class --- aider/voice.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/aider/voice.py b/aider/voice.py index bb247161d..047a0174d 100644 --- a/aider/voice.py +++ b/aider/voice.py @@ -104,9 +104,13 @@ class Voice: file.write(self.q.get()) with open(filename, "rb") as fh: - transcript = litellm.transcription( - model="whisper-1", file=fh, prompt=history, language=language - ) + try: + transcript = litellm.transcription( + model="whisper-1", file=fh, prompt=history, language=language + ) + except Exception as err: + print(f"Unable to transcribe {filename}: {err}") + return text = transcript.text return text