Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Retry on litellm's APIError, which includes 502 (#4167)

Engel Nyst1abfd3b8082a
diff --git a/openhands/llm/llm.py b/openhands/llm/llm.py
index c9088b3955..11a34a5121 100644
--- a/openhands/llm/llm.py
+++ b/openhands/llm/llm.py
@@ -14,6 +14,7 @@ from litellm import completion as litellm_completion
from litellm import completion_cost as litellm_completion_cost
from litellm.exceptions import (
APIConnectionError,
+ APIError,
InternalServerError,
RateLimitError,
ServiceUnavailableError,
@@ -31,6 +32,7 @@ __all__ = ['LLM']
# tuple of exceptions to retry on
LLM_RETRY_EXCEPTIONS: tuple[type[Exception], ...] = (
APIConnectionError,
+ APIError,
InternalServerError,
RateLimitError,
ServiceUnavailableError,