feat: add error handling for transcription in Voice class

This commit is contained in:
Paul Gauthier 2024-09-03 08:59:58 -07:00 committed by Paul Gauthier (aider)
parent b3ce70234e
commit aedba59c6e

View file

@ -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