Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recognize rate-limit and wait #114

Open
TiloGit opened this issue Jun 6, 2023 · 1 comment
Open

recognize rate-limit and wait #114

TiloGit opened this issue Jun 6, 2023 · 1 comment

Comments

@TiloGit
Copy link

TiloGit commented Jun 6, 2023

would be great if the tool could understand when a rate limit is hit and wait for the suggested seconds (seems to be always 20s) and try again.
maybe allow max retires in the cmd line.

Cheers

our request to Open AI API failed: 
Rate limit reached for default-gpt-3.5-turbo in organization org-OtZ--removed--  on requests per min. 
Limit: 3 / min. Please try again in 20s. Contact us through our help center at help.openai.com if you continue to have issues. 
Please add a payment method to your account to increase your rate limit. 
Visit https://platform.openai.com/account/billing to add a payment method.
@TiloGit
Copy link
Author

TiloGit commented Jun 6, 2023

here my poor man rate limit loop, might help someone for now.

###simple loop with rate limit helper 3 per min
for file in *.txt
do     
echo "$(date +"%F_%s")  now Work on ___ ${file}"
filebase=$(basename "$file" .txt)
i=$(($i+1))
echo "write letter ${filebase}" | chatgpt > "chatGPT-output/${file}"
##sleep to avoid rate limit
if test $i -gt 2 ; then echo "Wait to avoid rate limit: $i" && sleep 65 && i=$null; else echo "We are good :: $i" ; fi
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant