~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
refactor: deduplicate LLM settings wrapper across 6 files (#1964)
LearningCircuit960327ba99cc
diff --git a/src/local_deep_research/config/llm_config.py b/src/local_deep_research/config/llm_config.pyindex b16f38bca0..9043ed60de 100644--- a/src/local_deep_research/config/llm_config.py+++ b/src/local_deep_research/config/llm_config.py@@ -19,7 +19,7 @@ try:except ImportError:pass # Providers module not available yetfrom .thread_settings import (- get_setting_from_snapshot as _get_setting_from_snapshot,+ get_llm_setting_from_snapshot as get_setting_from_snapshot,NoSettingsContextError,)@@ -38,18 +38,6 @@ VALID_PROVIDERS = []-def get_setting_from_snapshot(- key, default=None, username=None, settings_snapshot=None-):- """Get setting from context only - no database access from threads.-- This is a wrapper around the shared function that enables fallback LLM check.- """- return _get_setting_from_snapshot(- key, default, username, settings_snapshot, check_fallback_llm=True- )--def is_openai_available(settings_snapshot=None):"""Check if OpenAI is available"""try:diff --git a/src/local_deep_research/config/thread_settings.py b/src/local_deep_research/config/thread_settings.pyindex d6f8878537..5adc1ea36f 100644--- a/src/local_deep_research/config/thread_settings.py+++ b/src/local_deep_research/config/thread_settings.py@@ -127,6 +127,19 @@ def get_setting_from_snapshot()+def get_llm_setting_from_snapshot(+ key, default=None, username=None, settings_snapshot=None+):+ """Get setting from snapshot with fallback LLM check enabled.++ Convenience wrapper used by LLM provider modules that always need+ ``check_fallback_llm=True``.+ """+ return get_setting_from_snapshot(+ key, default, username, settings_snapshot, check_fallback_llm=True+ )++def get_bool_setting_from_snapshot(key,default=False,diff --git a/src/local_deep_research/llm/providers/implementations/anthropic.py b/src/local_deep_research/llm/providers/implementations/anthropic.pyindex 9d3fc2970c..c7618d2ca0 100644--- a/src/local_deep_research/llm/providers/implementations/anthropic.py+++ b/src/local_deep_research/llm/providers/implementations/anthropic.py@@ -4,25 +4,13 @@ from langchain_anthropic import ChatAnthropicfrom loguru import loggerfrom ....config.thread_settings import (- get_setting_from_snapshot as _get_setting_from_snapshot,+ get_llm_setting_from_snapshot as get_setting_from_snapshot,NoSettingsContextError,)from ...llm_registry import register_llmfrom ..openai_base import OpenAICompatibleProvider-def get_setting_from_snapshot(- key, default=None, username=None, settings_snapshot=None-):- """Get setting from context only - no database access from threads.-- This is a wrapper around the shared function that enables fallback LLM check.- """- return _get_setting_from_snapshot(- key, default, username, settings_snapshot, check_fallback_llm=True- )--class AnthropicProvider(OpenAICompatibleProvider):"""Anthropic provider for Local Deep Research.diff --git a/src/local_deep_research/llm/providers/implementations/custom_openai_endpoint.py b/src/local_deep_research/llm/providers/implementations/custom_openai_endpoint.pyindex 2eb3f749b9..b04efadede 100644--- a/src/local_deep_research/llm/providers/implementations/custom_openai_endpoint.py+++ b/src/local_deep_research/llm/providers/implementations/custom_openai_endpoint.py@@ -3,25 +3,13 @@from loguru import loggerfrom ....config.thread_settings import (- get_setting_from_snapshot as _get_setting_from_snapshot,+ get_llm_setting_from_snapshot as get_setting_from_snapshot,)from ....utilities.url_utils import normalize_urlfrom ...llm_registry import register_llmfrom ..openai_base import OpenAICompatibleProvider-def get_setting_from_snapshot(- key, default=None, username=None, settings_snapshot=None-):- """Get setting from context only - no database access from threads.-- This is a wrapper around the shared function that enables fallback LLM check.- """- return _get_setting_from_snapshot(- key, default, username, settings_snapshot, check_fallback_llm=True- )--class CustomOpenAIEndpointProvider(OpenAICompatibleProvider):"""Custom OpenAI-compatible endpoint provider.diff --git a/src/local_deep_research/llm/providers/implementations/ollama.py b/src/local_deep_research/llm/providers/implementations/ollama.pyindex afd106ace1..78951a4d3f 100644--- a/src/local_deep_research/llm/providers/implementations/ollama.py+++ b/src/local_deep_research/llm/providers/implementations/ollama.py@@ -5,25 +5,13 @@ from langchain_ollama import ChatOllamafrom loguru import loggerfrom ....config.thread_settings import (- get_setting_from_snapshot as _get_setting_from_snapshot,+ get_llm_setting_from_snapshot as get_setting_from_snapshot,)from ....utilities.url_utils import normalize_urlfrom ...llm_registry import register_llmfrom ....security import safe_get-def get_setting_from_snapshot(- key, default=None, username=None, settings_snapshot=None-):- """Get setting from context only - no database access from threads.-- This is a wrapper around the shared function that enables fallback LLM check.- """- return _get_setting_from_snapshot(- key, default, username, settings_snapshot, check_fallback_llm=True- )--class OllamaProvider:"""Ollama provider for Local Deep Research.diff --git a/src/local_deep_research/llm/providers/implementations/openai.py b/src/local_deep_research/llm/providers/implementations/openai.pyindex fe9215bc1f..94d18829a2 100644--- a/src/local_deep_research/llm/providers/implementations/openai.py+++ b/src/local_deep_research/llm/providers/implementations/openai.py@@ -4,25 +4,13 @@ from langchain_openai import ChatOpenAIfrom loguru import loggerfrom ....config.thread_settings import (- get_setting_from_snapshot as _get_setting_from_snapshot,+ get_llm_setting_from_snapshot as get_setting_from_snapshot,NoSettingsContextError,)from ...llm_registry import register_llmfrom ..openai_base import OpenAICompatibleProvider-def get_setting_from_snapshot(- key, default=None, username=None, settings_snapshot=None-):- """Get setting from context only - no database access from threads.-- This is a wrapper around the shared function that enables fallback LLM check.- """- return _get_setting_from_snapshot(- key, default, username, settings_snapshot, check_fallback_llm=True- )--class OpenAIProvider(OpenAICompatibleProvider):"""OpenAI provider for Local Deep Research.diff --git a/src/local_deep_research/llm/providers/openai_base.py b/src/local_deep_research/llm/providers/openai_base.pyindex d16c5375f2..842e3a8420 100644--- a/src/local_deep_research/llm/providers/openai_base.py+++ b/src/local_deep_research/llm/providers/openai_base.py@@ -4,24 +4,12 @@ from langchain_openai import ChatOpenAIfrom loguru import loggerfrom ...config.thread_settings import (- get_setting_from_snapshot as _get_setting_from_snapshot,+ get_llm_setting_from_snapshot as get_setting_from_snapshot,NoSettingsContextError,)from ...utilities.url_utils import normalize_url-def get_setting_from_snapshot(- key, default=None, username=None, settings_snapshot=None-):- """Get setting from context only - no database access from threads.-- This is a wrapper around the shared function that enables fallback LLM check.- """- return _get_setting_from_snapshot(- key, default, username, settings_snapshot, check_fallback_llm=True- )--class OpenAICompatibleProvider:"""Base class for OpenAI-compatible API providers.