Better API error handling for Gemini
Problem:
Frequent "Model is overloaded" Errors coming whenever you try Gemini models, like 3 out of 5 requests fail.
Proposed Solution:
Implement automatic retries for API requests that fail due to "Model Overloaded" errors. The app should retry the request after a short interval (e.g., 5 seconds) until a successful response is received.
Why will it work?
I use the API frequently in a project of mine, and this simple fix solved the problem in 1 or a maximum of 3 retries, so it generally works better than logging the error in a popup dialog.
Why:
It's way easier than what I'm doing now: copying my last message, clicking the last message I tried to send, clicking delete, pasting it again, and clicking send. It's a pain!