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.

refactor: centralize USER_AGENT in constants.py at package root

LearningCircuitc8a77318de99
diff --git a/src/local_deep_research/constants.py b/src/local_deep_research/constants.py
new file mode 100644
index 0000000000..3cbb129714
--- /dev/null
+++ b/src/local_deep_research/constants.py
@@ -0,0 +1,18 @@
+"""Project-wide constants for Local Deep Research."""
+
+from .__version__ import __version__
+
+# Honest, identifying User-Agent for APIs that prefer/require identification
+# (e.g., academic APIs like arXiv, PubMed, OpenAlex)
+USER_AGENT = (
+ f"Local-Deep-Research/{__version__} "
+ "(Academic Research Tool; https://github.com/LearningCircuit/local-deep-research)"
+)
+
+# Browser-like User-Agent for sites that may block bot requests
+# Use sparingly and only when necessary
+BROWSER_USER_AGENT = (
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
+ "AppleWebKit/537.36 (KHTML, like Gecko) "
+ "Chrome/120.0.0.0 Safari/537.36"
+)
diff --git a/src/local_deep_research/research_library/downloaders/base.py b/src/local_deep_research/research_library/downloaders/base.py
index aee43c1af6..ad5d253faf 100644
--- a/src/local_deep_research/research_library/downloaders/base.py
+++ b/src/local_deep_research/research_library/downloaders/base.py
@@ -13,11 +13,9 @@ from loguru import logger
from ...web_search_engines.rate_limiting import (
AdaptiveRateLimitTracker,
)
-from ...__version__ import __version__
-# Centralized User-Agent for academic content downloads
-# Using honest identification as recommended by academic sources
-USER_AGENT = f"Local-Deep-Research/{__version__} (Academic Research Tool; https://github.com/LearningCircuit/local-deep-research)"
+# Import centralized User-Agent from constants
+from ...constants import USER_AGENT # noqa: F401 - re-exported for backward compatibility
class ContentType(Enum):