Skip to content

Commit

Permalink
Catch and appropriately retry *all* litellm exceptions #598
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed May 9, 2024
1 parent b158e1c commit 728a629
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions aider/sendchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
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)
Expand All @@ -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,
Expand Down

0 comments on commit 728a629

Please sign in to comment.