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 ScaleSerp integration

LearningCircuit0425330c921c
diff --git a/src/local_deep_research/web_search_engines/engines/search_engine_scaleserp.py b/src/local_deep_research/web_search_engines/engines/search_engine_scaleserp.py
index f4425707d5..cc9901bc65 100644
--- a/src/local_deep_research/web_search_engines/engines/search_engine_scaleserp.py
+++ b/src/local_deep_research/web_search_engines/engines/search_engine_scaleserp.py
@@ -6,7 +6,7 @@ from urllib.parse import urlparse
from langchain_core.language_models import BaseLLM
from ..search_engine_base import BaseSearchEngine
-from ..rate_limiting import RateLimitError
+from ..rate_limiting.exceptions import RateLimitError
class ScaleSerpSearchEngine(BaseSearchEngine):
@@ -132,8 +132,10 @@ class ScaleSerpSearchEngine(BaseSearchEngine):
# Add caching parameter if enabled - this is ScaleSerp's key feature!
# Cached results don't count against quota and are free for 1 hour
if self.enable_cache:
- params["output"] = "json" # Ensure JSON output
- # ScaleSerp automatically caches for 1 hour, no special param needed
+ params["output"] = (
+ "json" # Ensure JSON output format (not related to caching)
+ )
+ # ScaleSerp automatically caches for 1 hour; no special parameter is needed for caching
logger.info(
"Using ScaleSerp caching - repeated searches within 1 hour are free"
)
@@ -161,6 +163,10 @@ class ScaleSerpSearchEngine(BaseSearchEngine):
# Format results as previews
previews = []
+
+ # Check if results were served from cache for monitoring
+ from_cache = data.get("request_info", {}).get("cached", False)
+
for idx, result in enumerate(organic_results):
# Extract display link safely using urlparse
display_link = ""
@@ -168,7 +174,12 @@ class ScaleSerpSearchEngine(BaseSearchEngine):
if link:
try:
parsed_url = urlparse(link)
- display_link = parsed_url.netloc or parsed_url.path
+ # Use netloc for domain, fallback to truncated link (not path which could be a file path)
+ display_link = (
+ parsed_url.netloc
+ if parsed_url.netloc
+ else (link[:50] if link else "")
+ )
except Exception:
display_link = link[:50] if link else ""
@@ -179,6 +190,7 @@ class ScaleSerpSearchEngine(BaseSearchEngine):
"snippet": result.get("snippet", ""),
"displayed_link": display_link,
"position": result.get("position", idx + 1),
+ "from_cache": from_cache, # Add cache status for monitoring
}
# Store full ScaleSerp result for later