From 1e232d4db685d34c9a79381a2fb6262c21046d87 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 6 Aug 2024 14:32:52 -0300 Subject: [PATCH] Stop using litellm._should_retry --- aider/sendchat.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/aider/sendchat.py b/aider/sendchat.py index e3d40c23c..d840fb476 100644 --- a/aider/sendchat.py +++ b/aider/sendchat.py @@ -18,27 +18,6 @@ def lazy_litellm_retry_decorator(func): def wrapper(*args, **kwargs): import httpx - def should_giveup(e): - if not hasattr(e, "status_code"): - return False - - if type(e) in ( - httpx.ConnectError, - httpx.RemoteProtocolError, - httpx.ReadTimeout, - ): - return False - - # These seem to return .status_code = "" - # litellm._should_retry() expects an int and throws a TypeError - # - # litellm.llms.anthropic.AnthropicError - # litellm.exceptions.APIError - if not e.status_code: - return False - - return not litellm._should_retry(e.status_code) - decorated_func = backoff.on_exception( backoff.expo, ( @@ -53,7 +32,6 @@ def lazy_litellm_retry_decorator(func): litellm.exceptions.InternalServerError, litellm.llms.anthropic.AnthropicError, ), - giveup=should_giveup, max_time=60, on_backoff=lambda details: print( f"{details.get('exception', 'Exception')}\nRetry in {details['wait']:.1f} seconds."