Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: Address code review feedback for LLM rate limiting

LearningCircuit3f23a144d6e1
diff --git a/src/local_deep_research/web_search_engines/rate_limiting/llm/detection.py b/src/local_deep_research/web_search_engines/rate_limiting/llm/detection.py
index a0f53e3ca0..f48f417f32 100644
--- a/src/local_deep_research/web_search_engines/rate_limiting/llm/detection.py
+++ b/src/local_deep_research/web_search_engines/rate_limiting/llm/detection.py
@@ -2,9 +2,7 @@
LLM-specific rate limit error detection.
"""
-import logging
-
-logger = logging.getLogger(__name__)
+from loguru import logger
def is_llm_rate_limit_error(error: Exception) -> bool:
diff --git a/src/local_deep_research/web_search_engines/rate_limiting/llm/wrapper.py b/src/local_deep_research/web_search_engines/rate_limiting/llm/wrapper.py
index a84649076d..3973d56c8c 100644
--- a/src/local_deep_research/web_search_engines/rate_limiting/llm/wrapper.py
+++ b/src/local_deep_research/web_search_engines/rate_limiting/llm/wrapper.py
@@ -2,10 +2,10 @@
Rate-limited wrapper for LLM calls.
"""
-import logging
from typing import Optional
from urllib.parse import urlparse
+from loguru import logger
from tenacity import (
retry,
stop_after_attempt,
@@ -18,8 +18,6 @@ from ..exceptions import RateLimitError
from .detection import is_llm_rate_limit_error, extract_retry_after
from ....utilities.db_utils import get_db_setting
-logger = logging.getLogger(__name__)
-
class AdaptiveLLMWait(wait_base):
"""Adaptive wait strategy for LLM rate limiting."""
@@ -170,14 +168,15 @@ def create_rate_limited_llm_wrapper(base_llm, provider: Optional[str] = None):
return result
- except Exception:
- # Record failed attempt
- self.rate_limiter.record_outcome(
- engine_type=rate_limit_key,
- wait_time=0,
- success=False,
- retry_count=0,
- )
+ except Exception as e:
+ # Only record rate limit failures, not general failures
+ if is_llm_rate_limit_error(e):
+ self.rate_limiter.record_outcome(
+ engine_type=rate_limit_key,
+ wait_time=0,
+ success=False,
+ retry_count=0,
+ )
raise
else:
# No rate limiting, just invoke directly