From 4a42a07237cf1db7e69d002b25ab185bd1644998 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 1 Aug 2024 18:28:41 -0300 Subject: [PATCH] fix: Handle empty status codes in litellm retry decorator --- aider/sendchat.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aider/sendchat.py b/aider/sendchat.py index 42559e0bc..e3d40c23c 100644 --- a/aider/sendchat.py +++ b/aider/sendchat.py @@ -29,6 +29,14 @@ def lazy_litellm_retry_decorator(func): ): 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(