TomFrankly / pipedream-notion-voice-notes

Take notes with your voice and send them to Notion
103 stars 55 forks source link

Same error – An error occurred while attempting to split the file into chunks, or while sending the chunks to OpenAI. #48

Closed NotGilberto closed 10 months ago

NotGilberto commented 10 months ago

I'm seeing the same error as some of the others mentioned here ("Full error from OpenAI: Connection error."); I'm using paid accounts and have checked and re-loaded billing info, and re-done the API key. The file I'm working on is quite large (117MB), but I've had large files go over ok before.

Using plain gtp-3.5-turbo on the basic settings.

Do you think it's still the same problem of server loading? Should I split the file?

BTW, my API key shows as "Private", if this is an issue.

Thanks so much for any help.

NotGilberto commented 10 months ago

Just tried the system again, but using a smaller file (a size that has worked in past), and got the same error. So I don't think it's an issue of the file size.

TomFrankly commented 10 months ago

@NotGilberto can you post the contents of your Logs tab? That'll help us debug.

You shouldn't need to split the file, as my code does that for you behind the scenes. OpenAI's Whisper endpoint can only handle 24mb files, so by default the script splits larger files to that size.

In the advanced options, you can choose to split into even smaller chunks if you want, though this is typically only needed for increasing the speed of the workflow (smaller chunks w/ concurrent requests = faster processing time)

NotGilberto commented 10 months ago

Ok, here are some relevant bits:

An error occured while attempting to split the file into chunks, or while sending the chunks to OpenAI. If the full error below says "Unidentified connection error", please double-check that you have entered valid billing info in your OpenAI account. Afterward, generate a new API key and enter it in the OpenAI app here in Pipedream. Then, try running the workflow again. If that does not work, please open an issue at this workflow's Github repo: https://github.com/TomFrankly/pipedream-notion-voice-notes/issues Full error from OpenAI: Connection error. DETAILS at Object.chunkFileAndTranscribe (file:///pipedream/dist/code/4cf355a52ab0f9c275ba953eea42492276c4b796f961fdffefa87942b1ced4df/code/Notion-Voice-Notes.mjs:391:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at Object.run (file:///pipedream/dist/code/4cf355a52ab0f9c275ba953eea42492276c4b796f961fdffefa87942b1ced4df/code/Notion-Voice-Notes.mjs:1901:22) at null.executeComponent (/var/task/launch_worker.js:267:22) at MessagePort.messageHandler (/var/task/launch_worker.js:764:28)

...

Received response from OpenAI Whisper endpoint for chunk-002.m4a. Your API key's current Audio endpoing limits (learn more at https://platform.openai.com/docs/guides/rate-limits/overview): ┌────────────────────────┬──────────┐ │ (index) │ Values │ ├────────────────────────┼──────────┤ │ requestRate │ '50' │ │ tokenRate │ null │ │ remainingRequests │ '47' │ │ remainingTokens │ null │ │ rateResetTimeRemaining │ '3.447s' │ │ tokenRestTimeRemaining │ null │ └────────────────────────┴──────────┘ Received response from OpenAI Whisper endpoint for chunk-001.m4a. Your API key's current Audio endpoing limits (learn more at https://platform.openai.com/docs/guides/rate-limits/overview): ┌────────────────────────┬──────────┐ │ (index) │ Values │ ├────────────────────────┼──────────┤ │ requestRate │ '50' │ │ tokenRate │ null │ │ remainingRequests │ '48' │ │ remainingTokens │ null │ │ rateResetTimeRemaining │ '2.299s' │ │ tokenRestTimeRemaining │ null │ └────────────────────────┴──────────┘ Attempting to clean up the /tmp/ directory... Cleaning up /tmp/chunks-2YZsmUtP5J8SLEPMZ6Eoul9dbB3... This step was still trying to run code when the step ended. Make sure you promisify callback functions and await all Promises. (Reason: ChildProcess, Learn more: https://pipedream.com/docs/code/nodejs/async/)

TomFrankly commented 10 months ago

@NotGilberto gotcha. I think is a generic APIConnectionError from OpenAI, which means it doesn't get a status code but generally means the script was unable to connect to the OpenAI API. This is likely due to factors beyond our control – e.g. issues at OpenAI, or with AWS Lambda (what Pipedream workflows run on).

However, I've gone in and improved the code so that it'll now retry a few times if it hits this generic error. Previously, it would look for a status code before retrying, as I didn't know OpenAI's API had an error type that lacked a status code.

You can update your workflow like so: https://thomasjfrank.com/how-to-transcribe-audio-to-text-with-chatgpt-and-notion/#update

Hopefully this at least reduces the rate of errors like this, since the script will now retry automatically if it hits one!