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.

bugfix

LearningCircuit9c8b4b9fb6a4
diff --git a/pyproject.toml b/pyproject.toml
index f87b2e715b..58560751fa 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -51,6 +51,7 @@ dependencies = [
"lxml>=4.9.2",
"pdfplumber>=0.9.0",
"unstructured>=0.10.0",
+ "google-search-results",
]
diff --git a/src/local_deep_research/config.py b/src/local_deep_research/config.py
index 277ae86c6e..05baa7502f 100644
--- a/src/local_deep_research/config.py
+++ b/src/local_deep_research/config.py
@@ -6,10 +6,12 @@ from platformdirs import user_documents_dir
import os
# Setup logging
logger = logging.getLogger(__name__)
+from dotenv import load_dotenv
+import platform
# Get config directory
def get_config_dir():
- import platform
+
if platform.system() == "Windows":
# Windows: Use Documents directory
@@ -32,7 +34,16 @@ SEARCH_ENGINES_FILE = CONFIG_DIR / "search_engines.toml"
LOCAL_COLLECTIONS_FILE = CONFIG_DIR / "local_collections.toml"
+# Load the .env file explicitly
+# Load the .env file explicitly
+config_dir = get_config_dir()
+env_file = config_dir / ".env"
+if env_file.exists():
+ logger.info(f"Loading environment variables from: {env_file}")
+ load_dotenv(dotenv_path=env_file)
+else:
+ logger.warning(f"Warning: .env file not found at {env_file}")
# Set environment variable for Dynaconf to use
docs_base = Path(user_documents_dir()) / "local_deep_research"
os.environ["DOCS_DIR"] = str(docs_base)
diff --git a/src/local_deep_research/web_search_engines/search_engine_factory.py b/src/local_deep_research/web_search_engines/search_engine_factory.py
index dad0db0dfc..c99b235910 100644
--- a/src/local_deep_research/web_search_engines/search_engine_factory.py
+++ b/src/local_deep_research/web_search_engines/search_engine_factory.py
@@ -46,7 +46,10 @@ def create_search_engine(engine_name: str, llm=None, **kwargs) -> Optional[BaseS
# First check environment variable
api_key = os.getenv(api_key_env)
-
+ if not api_key:
+ api_key = os.getenv("LDR_" + api_key_env)
+
+
# If not found in environment, check Dynaconf settings
if not api_key and api_key_env:
# Convert env var name to settings path (e.g., BRAVE_API_KEY -> brave_api_key)