From 6405284461f6a57617a52cd80ab0461752d8fe0d Mon Sep 17 00:00:00 2001 From: Kangmoon Seo <100016044+KangmoonSeo@users.noreply.github.com> Date: Tue, 20 May 2025 18:22:33 +0900 Subject: [PATCH] fix: reorder exception handling to enable proper retry behavior --- pr_agent/algo/ai_handlers/litellm_ai_handler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pr_agent/algo/ai_handlers/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py index 88041658..8d727b8b 100644 --- a/pr_agent/algo/ai_handlers/litellm_ai_handler.py +++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py @@ -371,12 +371,12 @@ class LiteLLMAIHandler(BaseAiHandler): get_logger().info(f"\nUser prompt:\n{user}") response = await acompletion(**kwargs) - except (openai.APIError, openai.APITimeoutError) as e: - get_logger().warning(f"Error during LLM inference: {e}") - raise except (openai.RateLimitError) as e: get_logger().error(f"Rate limit error during LLM inference: {e}") raise + except (openai.APIError, openai.APITimeoutError) as e: + get_logger().warning(f"Error during LLM inference: {e}") + raise except (Exception) as e: get_logger().warning(f"Unknown error during LLM inference: {e}") raise openai.APIError from e