API limit?
Closed this issue · 2 comments
I'm not seeing anything here to avoid API limit errors for long texts, unless I'm missing something... I haven't been able to test your code yet to confirm.
The maximum length is 4096 characters per API call, per OpenAI docs, including system messages etc.
I didn't even know there as a 4096 character limit. I just made this asap for people to enjoy.
I'll think of a solution for dealing with this. Thanks for letting me know.
@curiousclinician ok try the new file and see what you think.
It now needs pip install pydub
and ffmpeg.
It splits files on the last paragraph before each 4096 character chunk -> receives one audio file per chunk -> save them as [name]_#.[extension] -> sends the next chunk (thus slowing down API calls as well) -> then concatenates the end result into the original [name].[extension] chosen by the user.
I recommend testing smaller batches before doing any seriously long work in it.
I was running into errors with deleting individual audio chunks after the concatenation at the end, so decided to keep all files for now.
The price estimate was also updated.
It's a bit rough around the edges, but should work.