mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
should_giveup?
This commit is contained in:
parent
2d91ee8dbb
commit
7c9c4fe788
1 changed files with 9 additions and 1 deletions
|
@ -18,6 +18,13 @@ CACHE = None
|
|||
litellm.suppress_debug_info = True
|
||||
|
||||
|
||||
def should_giveup(e):
|
||||
if not hasattr(e, "status_code"):
|
||||
return False
|
||||
|
||||
return not litellm._should_retry(e.status_code)
|
||||
|
||||
|
||||
@backoff.on_exception(
|
||||
backoff.expo,
|
||||
(
|
||||
|
@ -28,7 +35,8 @@ litellm.suppress_debug_info = True
|
|||
httpx.RemoteProtocolError,
|
||||
litellm.exceptions.ServiceUnavailableError,
|
||||
),
|
||||
max_tries=10,
|
||||
giveup=should_giveup,
|
||||
max_tries=3,
|
||||
on_backoff=lambda details: print(
|
||||
f"{details.get('exception','Exception')}\nRetry in {details['wait']:.1f} seconds."
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue