~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
Remove the `llm_config.py` file
Daniel Petti5ed8d8d441c3
diff --git a/pdm.lock b/pdm.lockindex cd4a04a0da..2467704469 100644--- a/pdm.lock+++ b/pdm.lock@@ -5,7 +5,7 @@groups = ["default", "dev"]strategy = ["inherit_metadata"]lock_version = "4.5.0"-content_hash = "sha256:76dcc565f0b282743e7e684610b43fb3c8d2ddc836d9e86479445d1e09fc4c63"+content_hash = "sha256:204f4fe8208bdf0829e0ad22a3d7ee91e8ad905b45c12a6afc20cc3b87559457"[[metadata.targets]]requires_python = ">=3.10"@@ -851,6 +851,19 @@ files = [{file = "fsspec-2025.3.0.tar.gz", hash = "sha256:a935fd1ea872591f2b5148907d103488fc523295e6c64b835cfad8c3eca44972"},]+[[package]]+name = "google-search-results"+version = "2.4.2"+requires_python = ">=3.5"+summary = "Scrape and search localized results from Google, Bing, Baidu, Yahoo, Yandex, Ebay, Homedepot, youtube at scale using SerpApi.com"+groups = ["default"]+dependencies = [+ "requests",+]+files = [+ {file = "google_search_results-2.4.2.tar.gz", hash = "sha256:603a30ecae2af8e600b22635757a6df275dad4b934f975e67878ccd640b78245"},+]+[[package]]name = "greenlet"version = "3.1.1"diff --git a/src/local_deep_research/config.py b/src/local_deep_research/config.pyindex 78816fe22a..08a7c5f630 100644--- a/src/local_deep_research/config.py+++ b/src/local_deep_research/config.py@@ -5,12 +5,29 @@ from pathlib import Pathfrom dynaconf import Dynaconffrom platformdirs import user_documents_dir+from langchain_anthropic import ChatAnthropic+from langchain_community.llms import VLLM+from langchain_ollama import ChatOllama+from langchain_openai import ChatOpenAI+from .utilties.search_utilities import remove_think_tags# Setup logginglogger = logging.getLogger(__name__)from dotenv import load_dotenvimport platform+# Valid provider options+VALID_PROVIDERS = [+ "ollama",+ "openai",+ "anthropic",+ "vllm",+ "openai_endpoint",+ "lmstudio",+ "llamacpp",+ "none",+]+# Get config directorydef get_config_dir():@@ -37,7 +54,6 @@ CONFIG_DIR = get_config_dir() / "config"CONFIG_DIR.mkdir(parents=True, exist_ok=True)SETTINGS_FILE = CONFIG_DIR / "settings.toml"SECRETS_FILE = CONFIG_DIR / ".secrets.toml"-LLM_CONFIG_FILE = CONFIG_DIR / "llm_config.py"SEARCH_ENGINES_FILE = CONFIG_DIR / "search_engines.toml"LOCAL_COLLECTIONS_FILE = CONFIG_DIR / "local_collections.toml"@@ -63,36 +79,6 @@ else:docs_base = Path(user_documents_dir()) / "local_deep_research"os.environ["DOCS_DIR"] = str(docs_base)--# Expose get_llm function-def get_llm(*args, **kwargs):- """- Helper function to get LLM from llm_config.py- """- # Import here to avoid circular imports- import importlib.util- import sys-- llm_config_path = CONFIG_DIR / "llm_config.py"-- # If llm_config.py exists, use it- if llm_config_path.exists():- if str(CONFIG_DIR) not in sys.path:- sys.path.insert(0, str(CONFIG_DIR))-- spec = importlib.util.spec_from_file_location("llm_config", llm_config_path)- llm_config = importlib.util.module_from_spec(spec)- spec.loader.exec_module(llm_config)-- if hasattr(llm_config, "get_llm"):- return llm_config.get_llm(*args, **kwargs)-- # Fallback to utility function- from .utilties.llm_utils import get_model-- return get_model(*args, **kwargs)--# Expose get_search functiondef get_search(search_tool=None):"""@@ -150,13 +136,6 @@ def init_config_files():shutil.copyfile(default_settings, settings_file)logger.info(f"Created settings.toml at {settings_file}")- # Create llm_config.py if it doesn't exist- llm_config_file = os.path.join(CONFIG_DIR, "llm_config.py")- default_llm = os.path.join(defaults_dir, "llm_config.py")- if not os.path.exists(llm_config_file) and os.path.exists(default_llm):- shutil.copyfile(default_llm, llm_config_file)- logger.info(f"Created llm_config.py at {llm_config_file}")-# Create local_collections.toml if it doesn't existcollections_file = os.path.join(CONFIG_DIR, "local_collections.toml")default_collections = os.path.join(defaults_dir, "local_collections.toml")@@ -196,7 +175,10 @@ def init_config_files():# Get default files pathtry:- defaults_dir = files("local_deep_research.defaults")+ try:+ defaults_dir = files("local_deep_research.defaults")+ except ModuleNotFoundError:+ defaults_dir = files("src.local_deep_research.defaults")except ImportError:# Fallback for older Python versionsfrom pkg_resources import resource_filename@@ -209,12 +191,6 @@ def init_config_files():shutil.copy(defaults_dir / "main.toml", settings_file)logger.info(f"Created settings.toml at {settings_file}")- # Create llm_config.py if it doesn't exist- llm_config_file = CONFIG_DIR / "llm_config.py"- if not llm_config_file.exists():- shutil.copy(defaults_dir / "llm_config.py", llm_config_file)- logger.info(f"Created llm_config.py at {llm_config_file}")-# Create local_collections.toml if it doesn't existcollections_file = CONFIG_DIR / "local_collections.toml"if not collections_file.exists():@@ -252,6 +228,340 @@ def init_config_files():""")+# ================================+# LLM FUNCTIONS+# ================================++def get_llm(model_name=None, temperature=None, provider=None):+ """+ Get LLM instance based on model name and provider.++ Args:+ model_name: Name of the model to use (if None, uses settings.llm.model)+ temperature: Model temperature (if None, uses settings.llm.temperature)+ provider: Provider to use (if None, uses settings.llm.provider)++ Returns:+ A LangChain LLM instance with automatic think-tag removal+ """+ # Use settings values for parameters if not provided+ if model_name is None:+ model_name = settings.llm.model++ if temperature is None:+ temperature = settings.llm.temperature++ if provider is None:+ provider = settings.llm.provider.lower()+ if provider not in VALID_PROVIDERS:+ logger.error(f"Invalid provider in settings: {provider}")+ raise ValueError(+ f"Invalid provider: {provider}. Must be one of: {VALID_PROVIDERS}"+ )++ # Common parameters for all models+ common_params = {+ "temperature": temperature,+ "max_tokens": settings.llm.max_tokens,+ }++ # Handle different providers+ if provider == "anthropic":+ api_key_name = 'ANTHROPIC_API_KEY'+ api_key = settings.get(api_key_name, '')+ if not api_key:+ api_key = os.getenv(api_key_name)+ if not api_key:+ api_key = os.getenv("LDR_" + api_key_name)+ if not api_key:+ logger.warning(+ "ANTHROPIC_API_KEY not found. Falling back to default model."+ )+ return get_fallback_model(temperature)++ llm = ChatAnthropic(+ model=model_name, anthropic_api_key=api_key, **common_params+ )+ return wrap_llm_without_think_tags(llm)++ elif provider == "openai":+ api_key_name = 'OPENAI_API_KEY'+ api_key = settings.get(api_key_name, '')+ if not api_key:+ api_key = os.getenv(api_key_name)+ if not api_key:+ api_key = os.getenv("LDR_" + api_key_name)+ if not api_key:+ logger.warning("OPENAI_API_KEY not found. Falling back to default model.")+ return get_fallback_model(temperature)++ llm = ChatOpenAI(model=model_name, api_key=api_key, **common_params)+ return wrap_llm_without_think_tags(llm)++ elif provider == "openai_endpoint":+ api_key_name = 'OPENAI_ENDPOINT_API_KEY'+ api_key = settings.get(api_key_name, '')+ if not api_key:+ api_key = os.getenv(api_key_name)+ if not api_key:+ api_key = os.getenv("LDR_" + api_key_name)+ if not api_key:+ logger.warning(+ "OPENAI_ENDPOINT_API_KEY not found. Falling back to default model."+ )+ return get_fallback_model(temperature)++ # Get endpoint URL from settings+ openai_endpoint_url = settings.llm.openai_endpoint_url++ llm = ChatOpenAI(+ model=model_name,+ api_key=api_key,+ openai_api_base=openai_endpoint_url,+ **common_params,+ )+ return wrap_llm_without_think_tags(llm)++ elif provider == "vllm":+ try:+ llm = VLLM(+ model=model_name,+ trust_remote_code=True,+ max_new_tokens=128,+ top_k=10,+ top_p=0.95,+ temperature=temperature,+ )+ return wrap_llm_without_think_tags(llm)+ except Exception as e:+ logger.error(f"Error loading VLLM model: {e}")+ logger.warning("Falling back.")+ return get_fallback_model(temperature)++ elif provider == "ollama":+ try:+ # Use the configurable Ollama base URL+ base_url = settings.get('OLLAMA_BASE_URL', settings.llm.get('ollama_base_url', 'http://localhost:11434'))+ llm = ChatOllama(model=model_name, base_url=base_url, **common_params)+ return wrap_llm_without_think_tags(llm)+ except Exception as e:+ logger.error(f"Error loading Ollama model: {e}")+ return get_fallback_model(temperature)++ elif provider == "lmstudio":+ # LM Studio supports OpenAI API format, so we can use ChatOpenAI directly+ lmstudio_url = settings.llm.get('lmstudio_url', "http://localhost:1234")++ llm = ChatOpenAI(+ model=model_name,+ api_key="lm-studio", # LM Studio doesn't require a real API key+ base_url=f"{lmstudio_url}/v1", # Use the configured URL with /v1 endpoint+ temperature=temperature,+ max_tokens=settings.llm.max_tokens+ )+ return wrap_llm_without_think_tags(llm)++ elif provider == "llamacpp":+ # Import LlamaCpp+ from langchain_community.llms import LlamaCpp++ # Get LlamaCpp model path from settings+ model_path = settings.llm.get('llamacpp_model_path', "")+ if not model_path:+ logger.error("llamacpp_model_path not set in settings")+ raise ValueError("llamacpp_model_path not set in settings.toml")++ # Get additional LlamaCpp parameters+ n_gpu_layers = settings.llm.get('llamacpp_n_gpu_layers', 1)+ n_batch = settings.llm.get('llamacpp_n_batch', 512)+ f16_kv = settings.llm.get('llamacpp_f16_kv', True)++ # Create LlamaCpp instance+ llm = LlamaCpp(+ model_path=model_path,+ temperature=temperature,+ max_tokens=settings.llm.max_tokens,+ n_gpu_layers=n_gpu_layers,+ n_batch=n_batch,+ f16_kv=f16_kv,+ verbose=True+ )+ return wrap_llm_without_think_tags(llm)++ else:+ return wrap_llm_without_think_tags(get_fallback_model(temperature))+++def get_fallback_model(temperature=None):+ """Create a dummy model for when no providers are available"""+ from langchain_community.llms.fake import FakeListLLM++ return FakeListLLM(+ responses=[+ "No language models are available. Please install Ollama or set up API keys."+ ]+ )+++# ================================+# COMPATIBILITY FUNCTIONS+# ================================++def wrap_llm_without_think_tags(llm):+ """Create a wrapper class that processes LLM outputs with remove_think_tags"""+++ class ProcessingLLMWrapper:+ def __init__(self, base_llm):+ self.base_llm = base_llm++ def invoke(self, *args, **kwargs):+ response = self.base_llm.invoke(*args, **kwargs)++ # Process the response content if it has a content attribute+ if hasattr(response, 'content'):+ response.content = remove_think_tags(response.content)+ elif isinstance(response, str):+ response = remove_think_tags(response)++ return response++ # Pass through any other attributes to the base LLM+ def __getattr__(self, name):+ return getattr(self.base_llm, name)++ return ProcessingLLMWrapper(llm)++def get_available_provider_types():+ """Return available model providers"""+ providers = {}++ if is_ollama_available():+ providers["ollama"] = "Ollama (local models)"++ if is_openai_available():+ providers["openai"] = "OpenAI API"++ if is_anthropic_available():+ providers["anthropic"] = "Anthropic API"++ if is_openai_endpoint_available():+ providers["openai_endpoint"] = "OpenAI-compatible Endpoint"++ if is_lmstudio_available():+ providers["lmstudio"] = "LM Studio (local models)"++ if is_llamacpp_available():+ providers["llamacpp"] = "LlamaCpp (local models)"++ # Check for VLLM capability+ try:+ import torch # noqa: F401+ import transformers # noqa: F401++ providers["vllm"] = "VLLM (local models)"+ except ImportError:+ pass++ # Default fallback+ if not providers:+ providers["none"] = "No model providers available"++ return providers+++# ================================+# HELPER FUNCTIONS+# ================================+++def is_openai_available():+ """Check if OpenAI is available"""+ try:+ api_key = settings.get("OPENAI_API_KEY", "")+ if not api_key:+ api_key = os.getenv("OPENAI_API_KEY")+ return bool(api_key)+ except Exception:+ return False+++def is_anthropic_available():+ """Check if Anthropic is available"""+ try:+ api_key = settings.get("ANTHROPIC_API_KEY", "")+ if not api_key:+ api_key = os.getenv("ANTHROPIC_API_KEY")+ return bool(api_key)+ except Exception:+ return False+++def is_openai_endpoint_available():+ """Check if OpenAI endpoint is available"""+ try:+ api_key = settings.get("OPENAI_ENDPOINT_API_KEY", "")+ if not api_key:+ api_key = os.getenv("OPENAI_ENDPOINT_API_KEY")+ return bool(api_key)+ except Exception:+ return False+++def is_ollama_available():+ """Check if Ollama is running"""+ try:+ import requests++ base_url = settings.get(+ "OLLAMA_BASE_URL",+ settings.llm.get("ollama_base_url", "http://localhost:11434"),+ )+ response = requests.get(f"{base_url}/api/tags", timeout=1.0)+ return response.status_code == 200+ except Exception:+ return False+++def is_vllm_available():+ """Check if VLLM capability is available"""+ try:+ import torch # noqa: F401+ import transformers # noqa: F401++ return True+ except ImportError:+ return False+++def is_lmstudio_available():+ """Check if LM Studio is available"""+ try:+ import requests++ lmstudio_url = settings.llm.get("lmstudio_url", "http://localhost:1234")+ # LM Studio typically uses OpenAI-compatible endpoints+ response = requests.get(f"{lmstudio_url}/v1/models", timeout=1.0)+ return response.status_code == 200+ except Exception:+ return False+++def is_llamacpp_available():+ """Check if LlamaCpp is available and configured"""+ try:+ from langchain_community.llms import LlamaCpp # noqa: F401++ model_path = settings.llm.get("llamacpp_model_path", "")+ return bool(model_path) and os.path.exists(model_path)+ except Exception:+ return False+++def get_available_providers():+ """Get dictionary of available providers"""+ return get_available_provider_types()+# Initialize config files on importinit_config_files()@@ -271,3 +581,12 @@ settings = Dynaconf(envvar_prefix="LDR",env_file=str(CONFIG_DIR / ".env"),)++# Log which providers are available+AVAILABLE_PROVIDERS = get_available_providers()+logger.info(f"Available providers: {list(AVAILABLE_PROVIDERS.keys())}")++# Check if selected provider is available+selected_provider = settings.llm.provider.lower()+if selected_provider not in AVAILABLE_PROVIDERS and selected_provider != "none":+ logger.warning(f"Selected provider {selected_provider} is not available.")diff --git a/src/local_deep_research/defaults/__init__.py b/src/local_deep_research/defaults/__init__.pyindex 58ab8d95f2..32c52c0235 100644--- a/src/local_deep_research/defaults/__init__.py+++ b/src/local_deep_research/defaults/__init__.py@@ -19,7 +19,6 @@ DEFAULT_FILES = {"main.toml": DEFAULTS_DIR / "main.toml","local_collections.toml": DEFAULTS_DIR / "local_collections.toml","search_engines.toml": DEFAULTS_DIR / "search_engines.toml",- "llm_config.py": DEFAULTS_DIR / "llm_config.py",}diff --git a/src/local_deep_research/defaults/search_engines.toml b/src/local_deep_research/defaults/search_engines.tomlindex 74d9e83e22..1e6ca8bbb6 100644--- a/src/local_deep_research/defaults/search_engines.toml+++ b/src/local_deep_research/defaults/search_engines.toml@@ -2,7 +2,7 @@# This file defines all available search engines and their properties[wikipedia]-module_path = "local_deep_research.web_search_engines.engines.search_engine_wikipedia"+module_path = ".engines.search_engine_wikipedia"class_name = "WikipediaSearchEngine"requires_api_key = falsereliability = 0.95@@ -17,7 +17,7 @@ max_results = 20include_content = true[arxiv]-module_path = "local_deep_research.web_search_engines.engines.search_engine_arxiv"+module_path = ".engines.search_engine_arxiv"class_name = "ArXivSearchEngine"requires_api_key = falsereliability = 0.9@@ -33,7 +33,7 @@ sort_by = "relevance"sort_order = "descending"[pubmed]-module_path = "local_deep_research.web_search_engines.engines.search_engine_pubmed"+module_path = ".engines.search_engine_pubmed"class_name = "PubMedSearchEngine"requires_api_key = falseapi_key_env = "NCBI_API_KEY"@@ -57,7 +57,7 @@ days_limit = 0optimize_queries = true[github]-module_path = "local_deep_research.web_search_engines.engines.search_engine_github"+module_path = ".engines.search_engine_github"class_name = "GitHubSearchEngine"requires_api_key = falsereliability = 0.99@@ -75,7 +75,7 @@ include_readme = trueinclude_issues = false[serpapi]-module_path = "local_deep_research.web_search_engines.engines.search_engine_serpapi"+module_path = ".engines.search_engine_serpapi"class_name = "SerpAPISearchEngine"requires_api_key = trueapi_key_env = "SERP_API_KEY"@@ -96,7 +96,7 @@ safe_search = truesearch_language = "English"[google_pse]-module_path = "local_deep_research.web_search_engines.engines.search_engine_google_pse"+module_path = ".engines.search_engine_google_pse"class_name = "GooglePSESearchEngine"requires_api_key = trueapi_key_env = "GOOGLE_PSE_API_KEY"@@ -111,7 +111,7 @@ weaknesses = ["requires search engine configuration in Google Control Panel"]supports_full_search = true-full_search_module = "local_deep_research.web_search_engines.engines.full_search"+full_search_module = ".engines.full_search"full_search_class = "FullSearchResults"[google_pse.default_params]@@ -120,7 +120,7 @@ safe_search = truesearch_language = "English"[brave]-module_path = "local_deep_research.web_search_engines.engines.search_engine_brave"+module_path = ".engines.search_engine_brave"class_name = "BraveSearchEngine"requires_api_key = trueapi_key_env = "BRAVE_API_KEY"@@ -141,7 +141,7 @@ safe_search = truesearch_language = "English"[wayback]-module_path = "local_deep_research.web_search_engines.engines.search_engine_wayback"+module_path = ".engines.search_engine_wayback"class_name = "WaybackSearchEngine"requires_api_key = falsereliability = 0.5@@ -162,7 +162,7 @@ closest_only = falselanguage = "English"[auto]-module_path = "local_deep_research.web_search_engines.engines.meta_search_engine"+module_path = ".engines.meta_search_engine"class_name = "MetaSearchEngine"requires_api_key = falsereliability = 0.85@@ -178,7 +178,7 @@ use_api_key_services = truemax_engines_to_try = 3[local_all]-module_path = "local_deep_research.web_search_engines.engines.search_engine_local_all"+module_path = ".engines.search_engine_local_all"class_name = "LocalAllSearchEngine"requires_api_key = falsereliability = 0.85@@ -187,7 +187,7 @@ weaknesses = ["may return too many results", "requires indexing"]requires_llm = true#[semantic_scholar]-#module_path = "local_deep_research.web_search_engines.engines.search_engine_semantic_scholar"+#module_path = ".engines.search_engine_semantic_scholar"#class_name = "SemanticScholarSearchEngine"#requires_api_key = false#api_key_env = "S2_API_KEY"@@ -232,7 +232,7 @@ DEFAULT_SEARCH_ENGINE = "wikipedia"# Uncomment and modify these templates as needed# [duckduckgo]-# module_path = "local_deep_research.web_search_engines.engines.search_engine_ddg"+# module_path = ".engines.search_engine_ddg"# class_name = "DuckDuckGoSearchEngine"# requires_api_key = false# reliability = 0.4@@ -250,7 +250,7 @@ DEFAULT_SEARCH_ENGINE = "wikipedia"# safe_search = true# [guardian]-# module_path = "local_deep_research.web_search_engines.engines.search_engine_guardian"+# module_path = ".engines.search_engine_guardian"# class_name = "GuardianSearchEngine"# requires_api_key = true# api_key_env = "GUARDIAN_API_KEY"diff --git a/src/local_deep_research/search_system.py b/src/local_deep_research/search_system.pyindex 80cba5f90e..be42565146 100644--- a/src/local_deep_research/search_system.py+++ b/src/local_deep_research/search_system.py@@ -367,7 +367,7 @@ class AdvancedSearchSystem::50]safe_query = safe_query.replace(" ", "_").lower()- import local_deep_research.config as conf+ from . import config as confoutput_dir = f"{conf.get_config_dir()}/research_outputs"if not os.path.exists(output_dir):diff --git a/src/local_deep_research/web/app.py b/src/local_deep_research/web/app.pyindex 102385bad2..4adbed4ff0 100644--- a/src/local_deep_research/web/app.py+++ b/src/local_deep_research/web/app.py@@ -36,7 +36,6 @@ logger = logging.getLogger(__name__)CONFIG_DIR = get_config_dir() / "config"MAIN_CONFIG_FILE = CONFIG_DIR / "settings.toml"-LLM_CONFIG_FILE = CONFIG_DIR / "llm_config.py"LOCAL_COLLECTIONS_FILE = CONFIG_DIR / "local_collections.toml"# Set flag for tracking OpenAI availability - we'll check it only when needed@@ -55,7 +54,7 @@ try:setup_user_directories()# Get directories based on package installation- PACKAGE_DIR = importlib_resources.files("local_deep_research") / "web"+ PACKAGE_DIR = importlib_resources.files("src.local_deep_research") / "web"with importlib_resources.as_file(PACKAGE_DIR) as package_dir:STATIC_DIR = (package_dir / "static").as_posix()TEMPLATE_DIR = (package_dir / "templates").as_posix()@@ -1592,13 +1591,6 @@ def main_config_page():"""Edit main configuration with search parameters"""return render_template("main_config.html", main_file_path=MAIN_CONFIG_FILE)--@research_bp.route("/settings/llm", methods=["GET"])-def llm_config_page():- """Edit LLM configuration using raw file editor"""- return render_template("llm_config.html", llm_file_path=LLM_CONFIG_FILE)--@research_bp.route("/settings/collections", methods=["GET"])def collections_config_page():"""Edit local collections configuration using raw file editor"""@@ -1679,38 +1671,6 @@ def save_search_engines_config():return jsonify({"success": False, "error": str(e)})-# API endpoint to save raw LLM config-@research_bp.route("/api/save_llm_config", methods=["POST"])-def save_llm_config():- try:- data = request.get_json()- raw_config = data.get("raw_config", "")-- # Validate Python syntax- try:- compile(raw_config, "<string>", "exec")- except SyntaxError as e:- return jsonify({"success": False, "error": f"Syntax error: {str(e)}"})-- # Ensure directory exists- os.makedirs(os.path.dirname(LLM_CONFIG_FILE), exist_ok=True)-- # Create a backup first- backup_path = f"{LLM_CONFIG_FILE}.bak"- if os.path.exists(LLM_CONFIG_FILE):- import shutil-- shutil.copy2(LLM_CONFIG_FILE, backup_path)-- # Write new config- with open(LLM_CONFIG_FILE, "w") as f:- f.write(raw_config)-- return jsonify({"success": True})- except Exception as e:- return jsonify({"success": False, "error": str(e)})--# API endpoint to save raw collections config@research_bp.route("/api/save_collections_config", methods=["POST"])def save_collections_config():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.pyindex ed5a2fcdc4..629c1fca81 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@@ -78,7 +78,12 @@ def create_search_engine(module_path = engine_config["module_path"]class_name = engine_config["class_name"]- module = importlib.import_module(module_path)+ package = None+ if module_path.startswith("."):+ # This is a relative import. Assume it's relative to+ # `web_search_engines`.+ package = "src.local_deep_research.web_search_engines"+ module = importlib.import_module(module_path, package=package)engine_class = getattr(module, class_name)# Get the engine class's __init__ parameters to filter out unsupported ones