From 77609ee1ba00a51cf1c37f1322924cad447a583d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=AE=AE=E0=AE=A9=E0=AF=8B=E0=AE=9C=E0=AF=8D=E0=AE=95?= =?UTF-8?q?=E0=AF=81=E0=AE=AE=E0=AE=BE=E0=AE=B0=E0=AF=8D=20=E0=AE=AA?= =?UTF-8?q?=E0=AE=B4=E0=AE=A9=E0=AE=BF=E0=AE=9A=E0=AF=8D=E0=AE=9A=E0=AE=BE?= =?UTF-8?q?=E0=AE=AE=E0=AE=BF?= Date: Wed, 26 Feb 2025 07:46:42 +0530 Subject: [PATCH] Add common exceptions for retry Fixes https://github.com/All-Hands-AI/OpenHands/issues/6942 Removed in https://github.com/All-Hands-AI/OpenHands/pull/6557 --- openhands/llm/llm.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openhands/llm/llm.py b/openhands/llm/llm.py index 671f902a6116..4adfc3161ae0 100644 --- a/openhands/llm/llm.py +++ b/openhands/llm/llm.py @@ -70,7 +70,15 @@ __all__ = ['LLM'] # tuple of exceptions to retry on -LLM_RETRY_EXCEPTIONS: tuple[type[Exception], ...] = (RateLimitError,) +LLM_RETRY_EXCEPTIONS: tuple[type[Exception], ...] = ( + APIConnectionError, + # FIXME: APIError is useful on 502 from a proxy for example, + # but it also retries on other errors that are permanent + APIError, + InternalServerError, + RateLimitError, + ServiceUnavailableError, + ) # cache prompt supporting models # remove this when we gemini and deepseek are supported