~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 langchain integration tests for Pydantic v2 compatibility
LearningCircuita51b7fdb68f4
diff --git a/tests/langchain_integration/test_combined_llm_retriever.py b/tests/langchain_integration/test_combined_llm_retriever.pyindex ffef3c89da..415909f3a3 100644--- a/tests/langchain_integration/test_combined_llm_retriever.py+++ b/tests/langchain_integration/test_combined_llm_retriever.py@@ -11,6 +11,7 @@ from typing import List, Any, Optionalfrom langchain.schema import BaseRetriever, Documentfrom langchain.llms.base import LLMfrom langchain.callbacks.manager import CallbackManagerForLLMRun+from pydantic import Fieldfrom local_deep_research.api.research_functions import (quick_summary,@@ -21,10 +22,12 @@ from local_deep_research.api.research_functions import (class CompanyKnowledgeRetriever(BaseRetriever):"""Simulates a company's internal knowledge base retriever."""- def __init__(self, knowledge_domain: str = "general"):+ knowledge_domain: str = Field(default="general")+ documents: List[Document] = Field(default_factory=list)++ def __init__(self, knowledge_domain: str = "general", **kwargs):"""Initialize with a specific knowledge domain."""- super().__init__()- self.knowledge_domain = knowledge_domain+ super().__init__(knowledge_domain=knowledge_domain, **kwargs)self.documents = self._load_domain_documents()def _load_domain_documents(self) -> List[Document]:@@ -105,13 +108,21 @@ class CompanyKnowledgeRetriever(BaseRetriever):class CompanyCustomLLM(LLM):"""Simulates a company's custom fine-tuned LLM."""+ model_version: str = Field(default="v1")+ use_company_style: bool = Field(default=True)+def __init__(- self, model_version: str = "v1", use_company_style: bool = True+ self,+ model_version: str = "v1",+ use_company_style: bool = True,+ **kwargs,):"""Initialize with company-specific parameters."""- super().__init__()- self.model_version = model_version- self.use_company_style = use_company_style+ super().__init__(+ model_version=model_version,+ use_company_style=use_company_style,+ **kwargs,+ )@propertydef _llm_type(self) -> str:@@ -165,7 +176,7 @@ class TestCombinedLLMRetriever:def settings_snapshot(self):"""Create settings snapshot for testing."""return {- "llm.provider": {"value": "custom", "type": "str"},+ "llm.provider": {"value": "none", "type": "str"},"llm.model": {"value": "company_llm_v1", "type": "str"},"llm.temperature": {"value": 0.7, "type": "float"},"llm.custom.api_key": {@@ -180,6 +191,17 @@ class TestCombinedLLMRetriever:"research.questions_per_iteration": {"value": 3, "type": "int"},"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"},}def test_engineering_research_with_custom_components(@@ -195,7 +217,7 @@ class TestCombinedLLMRetriever:)with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=10001,):result = quick_summary(@@ -235,7 +257,7 @@ class TestCombinedLLMRetriever:custom_llm = CompanyCustomLLM(model_version="v2")with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=20002,):result = detailed_research(@@ -302,7 +324,7 @@ class TestCombinedLLMRetriever:retriever = create_company_retriever("engineering", settings_snapshot)with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=30003,):result = quick_summary(@@ -323,8 +345,10 @@ class TestCombinedLLMRetriever:class UnreliableRetriever(BaseRetriever):"""Retriever that sometimes fails."""- def __init__(self):- super().__init__()+ call_count: int = Field(default=0)++ def __init__(self, **kwargs):+ super().__init__(**kwargs)self.call_count = 0def _get_relevant_documents(@@ -371,8 +395,12 @@ class TestCombinedLLMRetriever:class MonitoredLLM(CompanyCustomLLM):"""LLM that tracks performance metrics."""- def __init__(self):- super().__init__()+ call_count: int = Field(default=0)+ total_tokens: int = Field(default=0)+ response_times: List[float] = Field(default_factory=list)++ def __init__(self, **kwargs):+ super().__init__(**kwargs)self.call_count = 0self.total_tokens = 0self.response_times = []@@ -397,7 +425,7 @@ class TestCombinedLLMRetriever:retriever = CompanyKnowledgeRetriever("engineering")with patch(- "local_deep_research.api.research_functions.random.randint",+ "random.randint",return_value=40004,):result = quick_summary(