~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: remove dead-code overrides from OpenAI, Anthropic, and Google PSE (#4450) (#4458)
LearningCircuit6aa4a4328339
diff --git a/src/local_deep_research/llm/providers/implementations/anthropic.py b/src/local_deep_research/llm/providers/implementations/anthropic.pyindex f3f4e6a21f..fb8a6b07fb 100644--- a/src/local_deep_research/llm/providers/implementations/anthropic.py+++ b/src/local_deep_research/llm/providers/implementations/anthropic.py@@ -91,24 +91,3 @@ class AnthropicProvider(OpenAICompatibleProvider):)return ChatAnthropic(**anthropic_params)-- @classmethod- def is_available(cls, settings_snapshot=None):- """Check if this provider is available.-- Args:- settings_snapshot: Optional settings snapshot to use-- Returns:- True if API key is configured, False otherwise- """- try:- # Check if API key is configured- api_key = get_setting_from_snapshot(- cls.api_key_setting,- default=None,- settings_snapshot=settings_snapshot,- )- return bool(api_key and str(api_key).strip())- except Exception:- return Falsediff --git a/src/local_deep_research/llm/providers/implementations/openai.py b/src/local_deep_research/llm/providers/implementations/openai.pyindex 7a786aea1c..de08fbc435 100644--- a/src/local_deep_research/llm/providers/implementations/openai.py+++ b/src/local_deep_research/llm/providers/implementations/openai.py@@ -146,24 +146,3 @@ class OpenAIProvider(OpenAICompatibleProvider):)return ChatOpenAI(**openai_params)-- @classmethod- def is_available(cls, settings_snapshot=None):- """Check if this provider is available.-- Args:- settings_snapshot: Optional settings snapshot to use-- Returns:- True if API key is configured, False otherwise- """- try:- # Check if API key is configured- api_key = get_setting_from_snapshot(- cls.api_key_setting,- default=None,- settings_snapshot=settings_snapshot,- )- return bool(api_key and str(api_key).strip())- except Exception:- return Falsediff --git a/src/local_deep_research/web_search_engines/engines/search_engine_google_pse.py b/src/local_deep_research/web_search_engines/engines/search_engine_google_pse.pyindex 49894c3a44..a9d8947fef 100644--- a/src/local_deep_research/web_search_engines/engines/search_engine_google_pse.py+++ b/src/local_deep_research/web_search_engines/engines/search_engine_google_pse.py@@ -372,10 +372,3 @@ class GooglePSESearchEngine(BaseSearchEngine):"Retrieved {} search results for query: '{}'", len(results), query)return results-- def _get_full_content(- self, relevant_items: List[Dict[str, Any]]- ) -> List[Dict[str, Any]]:- """Get full content for search results"""- # Use the BaseSearchEngine implementation- return super()._get_full_content(relevant_items)diff --git a/tests/llm_providers/implementations/test_anthropic_provider.py b/tests/llm_providers/implementations/test_anthropic_provider.pyindex a9fc1af085..3ad7a708de 100644--- a/tests/llm_providers/implementations/test_anthropic_provider.py+++ b/tests/llm_providers/implementations/test_anthropic_provider.py@@ -202,7 +202,7 @@ class TestAnthropicIsAvailable:def test_is_available_true_when_key_exists(self):"""Returns True when API key is configured."""with patch(- "local_deep_research.llm.providers.implementations.anthropic.get_setting_from_snapshot"+ "local_deep_research.llm.providers.openai_base.get_setting_from_snapshot") as mock_get_setting:mock_get_setting.return_value = "test-key"@@ -212,7 +212,7 @@ class TestAnthropicIsAvailable:def test_is_available_false_when_no_key(self):"""Returns False when API key is not configured."""with patch(- "local_deep_research.llm.providers.implementations.anthropic.get_setting_from_snapshot"+ "local_deep_research.llm.providers.openai_base.get_setting_from_snapshot") as mock_get_setting:mock_get_setting.return_value = None@@ -222,7 +222,7 @@ class TestAnthropicIsAvailable:def test_is_available_false_when_empty_key(self):"""Returns False when API key is empty string."""with patch(- "local_deep_research.llm.providers.implementations.anthropic.get_setting_from_snapshot"+ "local_deep_research.llm.providers.openai_base.get_setting_from_snapshot") as mock_get_setting:mock_get_setting.return_value = ""@@ -232,7 +232,7 @@ class TestAnthropicIsAvailable:def test_is_available_false_on_exception(self):"""Returns False when exception occurs."""with patch(- "local_deep_research.llm.providers.implementations.anthropic.get_setting_from_snapshot"+ "local_deep_research.llm.providers.openai_base.get_setting_from_snapshot") as mock_get_setting:mock_get_setting.side_effect = Exception("Settings error")diff --git a/tests/llm_providers/implementations/test_openai_provider.py b/tests/llm_providers/implementations/test_openai_provider.pyindex 47f40d082c..62f622a5ca 100644--- a/tests/llm_providers/implementations/test_openai_provider.py+++ b/tests/llm_providers/implementations/test_openai_provider.py@@ -416,7 +416,7 @@ class TestOpenAIIsAvailable:def test_is_available_true_when_key_exists(self):"""Returns True when API key is configured."""with patch(- "local_deep_research.llm.providers.implementations.openai.get_setting_from_snapshot"+ "local_deep_research.llm.providers.openai_base.get_setting_from_snapshot") as mock_get_setting:mock_get_setting.return_value = "test-key"@@ -426,7 +426,7 @@ class TestOpenAIIsAvailable:def test_is_available_false_when_no_key(self):"""Returns False when API key is not configured."""with patch(- "local_deep_research.llm.providers.implementations.openai.get_setting_from_snapshot"+ "local_deep_research.llm.providers.openai_base.get_setting_from_snapshot") as mock_get_setting:mock_get_setting.return_value = None@@ -436,7 +436,7 @@ class TestOpenAIIsAvailable:def test_is_available_false_when_empty_key(self):"""Returns False when API key is empty string."""with patch(- "local_deep_research.llm.providers.implementations.openai.get_setting_from_snapshot"+ "local_deep_research.llm.providers.openai_base.get_setting_from_snapshot") as mock_get_setting:mock_get_setting.return_value = ""@@ -446,7 +446,7 @@ class TestOpenAIIsAvailable:def test_is_available_false_on_exception(self):"""Returns False when exception occurs."""with patch(- "local_deep_research.llm.providers.implementations.openai.get_setting_from_snapshot"+ "local_deep_research.llm.providers.openai_base.get_setting_from_snapshot") as mock_get_setting:mock_get_setting.side_effect = Exception("Settings error")@@ -456,7 +456,7 @@ class TestOpenAIIsAvailable:def test_is_available_with_settings_snapshot(self):"""Uses provided settings snapshot."""with patch(- "local_deep_research.llm.providers.implementations.openai.get_setting_from_snapshot"+ "local_deep_research.llm.providers.openai_base.get_setting_from_snapshot") as mock_get_setting:mock_get_setting.return_value = "test-key"snapshot = {"llm.openai.api_key": "test-key"}diff --git a/tests/llm_providers/test_anthropic_high_value.py b/tests/llm_providers/test_anthropic_high_value.pyindex 51d168d6e8..2399b07d62 100644--- a/tests/llm_providers/test_anthropic_high_value.py+++ b/tests/llm_providers/test_anthropic_high_value.py@@ -18,6 +18,11 @@ ANTHROPIC_MOD = "local_deep_research.llm.providers.implementations.anthropic"GET_SETTING = f"{ANTHROPIC_MOD}.get_setting_from_snapshot"CHAT_ANTHROPIC = f"{ANTHROPIC_MOD}.ChatAnthropic"+# Patch path for is_available(), which is inherited from OpenAICompatibleProvider+BASE_GET_SETTING = (+ "local_deep_research.llm.providers.openai_base.get_setting_from_snapshot"+)+def _make_setting_side_effect(overrides=None):"""Helper to build a mock side_effect for get_setting_from_snapshot."""@@ -210,7 +215,7 @@ class TestAnthropicIsAvailableEdgeCases:def test_whitespace_only_key_returns_false(self):"""Whitespace-only API key is stripped in is_available, returns False."""with patch(- GET_SETTING,+ BASE_GET_SETTING,side_effect=_make_setting_side_effect({"llm.anthropic.api_key": " \t\n "}),@@ -220,7 +225,7 @@ class TestAnthropicIsAvailableEdgeCases:def test_valid_key_with_leading_trailing_whitespace(self):"""A valid key with surrounding whitespace should still be available."""with patch(- GET_SETTING,+ BASE_GET_SETTING,side_effect=_make_setting_side_effect({"llm.anthropic.api_key": " sk-ant-valid-key "}),@@ -229,13 +234,13 @@ class TestAnthropicIsAvailableEdgeCases:def test_is_available_catches_runtime_error(self):"""is_available should catch RuntimeError from missing settings context."""- with patch(GET_SETTING) as mock_get:+ with patch(BASE_GET_SETTING) as mock_get:mock_get.side_effect = RuntimeError("No settings context")assert AnthropicProvider.is_available() is Falsedef test_is_available_catches_type_error(self):"""is_available should catch TypeError."""- with patch(GET_SETTING) as mock_get:+ with patch(BASE_GET_SETTING) as mock_get:mock_get.side_effect = TypeError("unexpected type")assert AnthropicProvider.is_available() is Falsediff --git a/tests/web_search_engines/engines/test_search_engine_google_pse_extra_coverage.py b/tests/web_search_engines/engines/test_search_engine_google_pse_extra_coverage.pyindex b93c633d37..033ff36fec 100644--- a/tests/web_search_engines/engines/test_search_engine_google_pse_extra_coverage.py+++ b/tests/web_search_engines/engines/test_search_engine_google_pse_extra_coverage.py@@ -232,21 +232,3 @@ class TestGetPreviewsExceptionInLoop:engine._make_request = Mock(return_value=page)previews = engine._get_previews("query")assert previews[0]["source"] == "Google Programmable Search"---# ----------------------------------------------------------------------------# _get_full_content delegates to super()-# ------------------------------------------------------------------------------class TestGetFullContentDelegates:- def test_delegates_to_base(self):- engine = _make_engine()- items = [{"title": "T", "link": "https://t.com", "snippet": "s"}]- with patch(- "local_deep_research.web_search_engines.search_engine_base.BaseSearchEngine._get_full_content",- return_value=items,- ) as mock_super:- result = engine._get_full_content(items)- mock_super.assert_called_once_with(items)- assert result is items