diff --git a/aider/sendchat.py b/aider/sendchat.py index 8420c929e..02494af9f 100644 --- a/aider/sendchat.py +++ b/aider/sendchat.py @@ -15,7 +15,7 @@ CACHE = None RETRY_TIMEOUT = 60 - +#ai def retry_exceptions(): import httpx @@ -25,19 +25,18 @@ def retry_exceptions(): httpx.RemoteProtocolError, httpx.ReadTimeout, # litellm - litellm.exceptions.BadRequestError, - litellm.exceptions.AuthenticationError, - litellm.exceptions.PermissionDeniedError, - litellm.exceptions.NotFoundError, - litellm.exceptions.UnprocessableEntityError, - litellm.exceptions.RateLimitError, - litellm.exceptions.InternalServerError, - litellm.exceptions.ContextWindowExceededError, - litellm.exceptions.ContentPolicyViolationError, - litellm.exceptions.APIConnectionError, - litellm.exceptions.APIError, - litellm.exceptions.ServiceUnavailableError, - litellm.exceptions.Timeout, + litellm.AuthenticationError, + litellm.PermissionDeniedError, + litellm.NotFoundError, + litellm.UnprocessableEntityError, + litellm.RateLimitError, + litellm.InternalServerError, + litellm.ContextWindowExceededError, + litellm.ContentPolicyViolationError, + litellm.APIConnectionError, + litellm.APIError, + litellm.ServiceUnavailableError, + litellm.Timeout, ) @@ -111,5 +110,5 @@ def simple_send_with_retries(model_name, messages, extra_params=None): _hash, response = send_completion(**kwargs) return response.choices[0].message.content - except (AttributeError, litellm.exceptions.BadRequestError): + except (AttributeError, litellm.BadRequestError): return diff --git a/tests/basic/test_sendchat.py b/tests/basic/test_sendchat.py index f77e687ef..a1cb8bf5d 100644 --- a/tests/basic/test_sendchat.py +++ b/tests/basic/test_sendchat.py @@ -10,7 +10,7 @@ from aider.sendchat import simple_send_with_retries class PrintCalled(Exception): pass - +#ai add a test that simply invokes retry_exceptions() and ensures no error raised! class TestSendChat(unittest.TestCase): @patch("litellm.completion") @patch("builtins.print")