Whisper API - Retry errors, requests show up in the dashboard

Hey folks,

We have a workflow in our product where we allow folks to use audio files to build contexts (in our vector DB).

However after hitting the whisper API with a files in order the 3rd or 4th always times out and we’re getting this error repeatedly:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/billiard/pool.py", line 366, in workloop
    put((READY, (job, i, result, inqW_fd)))
  File "/usr/local/lib/python3.9/site-packages/billiard/queues.py", line 366, in put
  File "/usr/local/lib/python3.9/site-packages/billiard/reduction.py", line 56, in dumps
    cls(buf, protocol).dump(obj)
billiard.pool.MaybeEncodingError: Error sending result: '"(1, <ExceptionInfo: RetryError('<Future at 0x7f8c4002fbb0 state=finished raised APIError>')>, None)"'. Reason: ''PicklingError("Can\'t pickle <class \'tenacity.RetryError\'>: it\'s not the same object as tenacity.RetryError")''.

We’ve wrapped our code like so:

@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
    def transcribe_with_backoff(self, path):
        audio_file = open(path, "rb")
        logging.info("transcribing with backoff")
        response = openai.Audio.transcribe(
        return response

Having said that - I can see the file actually did come through.

What am I doing wrong here? The API basically gives an error, but the requests still show up and we will get billed for them.

I got it to work by reducing the file size… but now it translates the results into welsh.
Anyone ever seen anything like it?


you might take a look at this post