From 62e93d4002bed4d08447206c29ac378166db89af Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 7 Nov 2024 12:19:41 -0800 Subject: [PATCH] feat: add custom exceptions module --- aider/exceptions.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 aider/exceptions.py diff --git a/aider/exceptions.py b/aider/exceptions.py new file mode 100644 index 000000000..b615924f3 --- /dev/null +++ b/aider/exceptions.py @@ -0,0 +1,35 @@ + + +def retry_exceptions(): + import httpx + import openai + + return ( + # httpx + httpx.ConnectError, + httpx.RemoteProtocolError, + httpx.ReadTimeout, + # + # litellm exceptions inherit from openai exceptions + # https://docs.litellm.ai/docs/exception_mapping + # + # openai.BadRequestError, + # litellm.ContextWindowExceededError, + # litellm.ContentPolicyViolationError, + # + # openai.AuthenticationError, + # openai.PermissionDeniedError, + # openai.NotFoundError, + # + openai.APITimeoutError, + openai.UnprocessableEntityError, + openai.RateLimitError, + openai.APIConnectionError, + # openai.APIError, + # openai.APIStatusError, + openai.InternalServerError, + ) + + +class LiteLLMExceptions: + # ai