mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 19:24:59 +00:00
Catch and appropriately retry *all* litellm exceptions #598
This commit is contained in:
parent
b158e1c230
commit
728a629789
1 changed files with 7 additions and 6 deletions
|
@ -5,12 +5,12 @@ import backoff
|
||||||
import httpx
|
import httpx
|
||||||
import openai
|
import openai
|
||||||
|
|
||||||
# from diskcache import Cache
|
|
||||||
from openai import APIConnectionError, InternalServerError, RateLimitError
|
|
||||||
|
|
||||||
from aider.dump import dump # noqa: F401
|
from aider.dump import dump # noqa: F401
|
||||||
from aider.litellm import litellm
|
from aider.litellm import litellm
|
||||||
|
|
||||||
|
# from diskcache import Cache
|
||||||
|
|
||||||
|
|
||||||
CACHE_PATH = "~/.aider.send.cache.v1"
|
CACHE_PATH = "~/.aider.send.cache.v1"
|
||||||
CACHE = None
|
CACHE = None
|
||||||
# CACHE = Cache(CACHE_PATH)
|
# CACHE = Cache(CACHE_PATH)
|
||||||
|
@ -26,12 +26,13 @@ def should_giveup(e):
|
||||||
@backoff.on_exception(
|
@backoff.on_exception(
|
||||||
backoff.expo,
|
backoff.expo,
|
||||||
(
|
(
|
||||||
InternalServerError,
|
|
||||||
RateLimitError,
|
|
||||||
APIConnectionError,
|
|
||||||
httpx.ConnectError,
|
httpx.ConnectError,
|
||||||
httpx.RemoteProtocolError,
|
httpx.RemoteProtocolError,
|
||||||
|
litellm.exceptions.APIConnectionError,
|
||||||
|
litellm.exceptions.APIError,
|
||||||
|
litellm.exceptions.RateLimitError,
|
||||||
litellm.exceptions.ServiceUnavailableError,
|
litellm.exceptions.ServiceUnavailableError,
|
||||||
|
litellm.exceptions.Timeout,
|
||||||
),
|
),
|
||||||
giveup=should_giveup,
|
giveup=should_giveup,
|
||||||
max_time=60,
|
max_time=60,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue