mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 05:29:12 +00:00
Retry (with fallback) on Gemini fails with internal server error
Khoj should use a fallback model when available to retry request if calls to Gemini fail with internal server error.
This commit is contained in:
@@ -144,7 +144,7 @@ def is_retryable_exception(exception: BaseException) -> bool:
|
|||||||
# Google/Gemini exceptions
|
# Google/Gemini exceptions
|
||||||
if isinstance(exception, (gerrors.APIError, gerrors.ClientError)):
|
if isinstance(exception, (gerrors.APIError, gerrors.ClientError)):
|
||||||
# Check for specific error codes that are retryable
|
# Check for specific error codes that are retryable
|
||||||
if hasattr(exception, "code") and exception.code in [429, 502, 503, 504]:
|
if hasattr(exception, "code") and exception.code in [429, 500, 502, 503, 504]:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Network errors
|
# Network errors
|
||||||
|
|||||||
Reference in New Issue
Block a user