~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
fix: Fix remaining test failures for settings context and Pydantic v2
LearningCircuit5f79613df35f
diff --git a/tests/langchain_integration/test_custom_langchain_llm.py b/tests/langchain_integration/test_custom_langchain_llm.pyindex ba4b2da228..d3b76100b2 100644--- a/tests/langchain_integration/test_custom_langchain_llm.py+++ b/tests/langchain_integration/test_custom_langchain_llm.py@@ -64,7 +64,7 @@ class TestCustomLangChainLLM:def settings_snapshot(self):"""Create a settings snapshot for testing."""return {- "llm.provider": {"value": "custom", "type": "str"},+ "llm.provider": {"value": "none", "type": "str"},"llm.model": {"value": "custom_test_llm", "type": "str"},"llm.temperature": {"value": 0.7, "type": "float"},"llm.custom.api_key": {"value": "test-key", "type": "str"},@@ -73,6 +73,17 @@ class TestCustomLangChainLLM:"research.search_engines": {"value": ["wikipedia"], "type": "list"},"research.local_context": {"value": 2000, "type": "int"},"research.web_context": {"value": 2000, "type": "int"},+ "llm.context_window_unrestricted": {"value": False, "type": "bool"},+ "llm.context_window_size": {"value": 8192, "type": "int"},+ "llm.local_context_window_size": {"value": 4096, "type": "int"},+ "llm.supports_max_tokens": {"value": True, "type": "bool"},+ "llm.max_tokens": {"value": 4096, "type": "int"},+ "rate_limiting.llm_enabled": {"value": False, "type": "bool"},+ "search.tool": {"value": "wikipedia", "type": "str"},+ "search.max_results": {"value": 10, "type": "int"},+ "search.cross_engine_max_results": {"value": 100, "type": "int"},+ "search.cross_engine_use_reddit": {"value": False, "type": "bool"},+ "search.cross_engine_min_date": {"value": None, "type": "str"},}def test_custom_llm_basic_usage(self, settings_snapshot):@@ -143,7 +154,7 @@ class TestCustomLangChainLLM:]with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=67890,):result = detailed_research(@@ -199,7 +210,7 @@ class TestCustomLangChainLLM:]with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=11111,):result = quick_summary(@@ -320,7 +331,7 @@ class TestCustomLangChainLLM:]with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=99999,):result = quick_summary(diff --git a/tests/langchain_integration/test_custom_langchain_retriever.py b/tests/langchain_integration/test_custom_langchain_retriever.pyindex 6b2b3b2ef7..f0302cf34c 100644--- a/tests/langchain_integration/test_custom_langchain_retriever.py+++ b/tests/langchain_integration/test_custom_langchain_retriever.py@@ -10,6 +10,7 @@ from unittest.mock import Mock, patchfrom typing import Listfrom langchain.schema import BaseRetriever, Documentfrom langchain.callbacks.manager import CallbackManagerForRetrieverRun+from pydantic import Fieldfrom local_deep_research.api.research_functions import (quick_summary,@@ -21,9 +22,11 @@ from local_deep_research.api.research_functions import (class CustomTestRetriever(BaseRetriever):"""Custom retriever for testing."""- def __init__(self, documents: List[Document] = None):+ documents: List[Document] = Field(default_factory=list)++ def __init__(self, documents: List[Document] = None, **kwargs):"""Initialize with optional documents."""- super().__init__()+ super().__init__(**kwargs)self.documents = documents or self._get_default_documents()def _get_default_documents(self) -> List[Document]:@@ -106,6 +109,17 @@ class TestCustomLangChainRetriever:"research.search_engines": {"value": ["custom_kb"], "type": "list"},"research.local_context": {"value": 2000, "type": "int"},"research.web_context": {"value": 2000, "type": "int"},+ "llm.context_window_unrestricted": {"value": False, "type": "bool"},+ "llm.context_window_size": {"value": 8192, "type": "int"},+ "llm.local_context_window_size": {"value": 4096, "type": "int"},+ "llm.supports_max_tokens": {"value": True, "type": "bool"},+ "llm.max_tokens": {"value": 4096, "type": "int"},+ "rate_limiting.llm_enabled": {"value": False, "type": "bool"},+ "search.tool": {"value": "auto", "type": "str"},+ "search.max_results": {"value": 10, "type": "int"},+ "search.cross_engine_max_results": {"value": 100, "type": "int"},+ "search.cross_engine_use_reddit": {"value": False, "type": "bool"},+ "search.cross_engine_min_date": {"value": None, "type": "str"},}@pytest.fixture@@ -132,7 +146,7 @@ class TestCustomLangChainRetriever:return_value=mock_llm,):with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=12345,):# Run quick summary with custom retriever@@ -196,7 +210,7 @@ class TestCustomLangChainRetriever:return_value=mock_llm,):with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=67890,):result = detailed_research(@@ -278,7 +292,7 @@ class TestCustomLangChainRetriever:return_value=mock_llm,):with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=22222,):# Should handle gracefully even with no results@@ -302,7 +316,7 @@ class TestCustomLangChainRetriever:custom_retriever = CustomTestRetriever()with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=33333,):# Use both custom LLM and retriever@@ -375,7 +389,7 @@ class TestCustomLangChainRetriever:return_value=mock_llm,):with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=44444,):result = generate_report(@@ -417,7 +431,7 @@ class TestCustomLangChainRetriever:return_value=mock_llm,):with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=55555,):result = quick_summary(diff --git a/tests/test_llm_provider_integration.py b/tests/test_llm_provider_integration.pyindex 716dc18544..821f9672e1 100644--- a/tests/test_llm_provider_integration.py+++ b/tests/test_llm_provider_integration.py@@ -289,19 +289,30 @@ class TestLLMProviderIntegration:settings_manager.set_setting("llm.openai_endpoint.api_key", "sk-test-key")- with patch(- "local_deep_research.config.llm_config.get_setting_from_db_main_thread"- ) as mock_get_setting:- mock_get_setting.return_value = "sk-test-key"- assert is_openai_endpoint_available() is True+ settings_with_key = {+ "llm.openai_endpoint.api_key": {+ "value": "sk-test-key",+ "type": "str",+ }+ }+ assert (+ is_openai_endpoint_available(+ settings_snapshot=settings_with_key+ )+ is True+ )# Without API keysettings_manager.set_setting("llm.openai_endpoint.api_key", None)- with patch(- "local_deep_research.config.llm_config.get_setting_from_db_main_thread"- ) as mock_get_setting:- mock_get_setting.return_value = None- assert is_openai_endpoint_available() is False+ settings_without_key = {+ "llm.openai_endpoint.api_key": {"value": None, "type": "str"}+ }+ assert (+ is_openai_endpoint_available(+ settings_snapshot=settings_without_key+ )+ is False+ )def test_custom_model_configuration(self, mock_session):"""Test configuring custom models with API endpoints."""