mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
Don't retry on gemini RECITATION error
This commit is contained in:
parent
d6783636c5
commit
7b14d77e9e
1 changed files with 9 additions and 0 deletions
|
@ -18,6 +18,12 @@ CACHE = None
|
||||||
litellm.suppress_debug_info = True
|
litellm.suppress_debug_info = True
|
||||||
|
|
||||||
|
|
||||||
|
def giveup_on_recitiation(ex):
|
||||||
|
if not isinstance(ex, litellm.exceptions.BadRequestError):
|
||||||
|
return
|
||||||
|
return "RECITATION" in str(ex)
|
||||||
|
|
||||||
|
|
||||||
@backoff.on_exception(
|
@backoff.on_exception(
|
||||||
backoff.expo,
|
backoff.expo,
|
||||||
(
|
(
|
||||||
|
@ -27,6 +33,7 @@ litellm.suppress_debug_info = True
|
||||||
httpx.ConnectError,
|
httpx.ConnectError,
|
||||||
litellm.exceptions.BadRequestError,
|
litellm.exceptions.BadRequestError,
|
||||||
),
|
),
|
||||||
|
giveup=giveup_on_recitiation,
|
||||||
max_tries=10,
|
max_tries=10,
|
||||||
on_backoff=lambda details: print(
|
on_backoff=lambda details: print(
|
||||||
f"{details.get('exception','Exception')}\nRetry in {details['wait']:.1f} seconds."
|
f"{details.get('exception','Exception')}\nRetry in {details['wait']:.1f} seconds."
|
||||||
|
@ -50,6 +57,8 @@ def send_with_retries(model_name, messages, functions, stream):
|
||||||
if not stream and CACHE is not None and key in CACHE:
|
if not stream and CACHE is not None and key in CACHE:
|
||||||
return hash_object, CACHE[key]
|
return hash_object, CACHE[key]
|
||||||
|
|
||||||
|
# del kwargs['stream']
|
||||||
|
|
||||||
res = litellm.completion(**kwargs)
|
res = litellm.completion(**kwargs)
|
||||||
|
|
||||||
if not stream and CACHE is not None:
|
if not stream and CACHE is not None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue