Przeglądaj źródła

retry for internal server error (#2806)

Xingyao Wang 1 rok temu
rodzic
commit
82f4860470
1 zmienionych plików z 7 dodań i 1 usunięć
  1. 7 1
      opendevin/llm/llm.py

+ 7 - 1
opendevin/llm/llm.py

@@ -8,6 +8,7 @@ from litellm import completion as litellm_completion
 from litellm import completion_cost as litellm_completion_cost
 from litellm.exceptions import (
     APIConnectionError,
+    InternalServerError,
     RateLimitError,
     ServiceUnavailableError,
 )
@@ -184,7 +185,12 @@ class LLM:
             stop=stop_after_attempt(num_retries),
             wait=wait_random_exponential(min=retry_min_wait, max=retry_max_wait),
             retry=retry_if_exception_type(
-                (RateLimitError, APIConnectionError, ServiceUnavailableError)
+                (
+                    RateLimitError,
+                    APIConnectionError,
+                    ServiceUnavailableError,
+                    InternalServerError,
+                )
             ),
             after=attempt_on_error,
         )