From 728a6297894ca9c2d6c936a9b682a6501e4424fc Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 9 May 2024 14:16:09 -0700 Subject: [PATCH] Catch and appropriately retry *all* litellm exceptions #598 --- aider/sendchat.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/aider/sendchat.py b/aider/sendchat.py index 0dc27e63b..3708ce799 100644 --- a/aider/sendchat.py +++ b/aider/sendchat.py @@ -5,12 +5,12 @@ import backoff import httpx import openai -# from diskcache import Cache -from openai import APIConnectionError, InternalServerError, RateLimitError - from aider.dump import dump # noqa: F401 from aider.litellm import litellm +# from diskcache import Cache + + CACHE_PATH = "~/.aider.send.cache.v1" CACHE = None # CACHE = Cache(CACHE_PATH) @@ -26,12 +26,13 @@ def should_giveup(e): @backoff.on_exception( backoff.expo, ( - InternalServerError, - RateLimitError, - APIConnectionError, httpx.ConnectError, httpx.RemoteProtocolError, + litellm.exceptions.APIConnectionError, + litellm.exceptions.APIError, + litellm.exceptions.RateLimitError, litellm.exceptions.ServiceUnavailableError, + litellm.exceptions.Timeout, ), giveup=should_giveup, max_time=60,