~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
from datetime import datetime
from unittest.mock import Mock, patch
import pytest
from local_deep_research.utilities.arxiv_api import (
ArxivIdRequest,
ArxivQueryRequest,
ArxivSortCriterion,
ArxivSortOrder,
)
ENGINE_MODULE = (
"local_deep_research.web_search_engines.engines.search_engine_arxiv"
)
FETCH_SEAM = f"{ENGINE_MODULE}.fetch_arxiv_results"
JOURNAL_FILTER_SEAM = (
"local_deep_research.advanced_search_system.filters."
"journal_reputation_filter."
"JournalReputationFilter.create_default"
)
def _make_engine():
from local_deep_research.web_search_engines.engines.search_engine_arxiv import (
ArXivSearchEngine,
)
with patch(JOURNAL_FILTER_SEAM, return_value=None):
engine = ArXivSearchEngine()
engine.rate_tracker.apply_rate_limit = Mock(return_value=0)
return engine
def _make_detail_paper() -> Mock:
paper = Mock()
paper.entry_id = "https://arxiv.org/abs/2101.12345"
paper.title = "Test Paper"
paper.summary = "Short summary"
paper.authors = [Mock(name="Author 1")]
paper.published = datetime(2021, 1, 15)
paper.updated = datetime(2021, 2, 15)
paper.journal_ref = "Journal Ref"
paper.pdf_url = "https://arxiv.org/pdf/2101.12345.pdf"
paper.categories = ["cs.AI"]
paper.comment = "Comment"
paper.doi = "10.1234/test"
return paper
def test_query_search_uses_typed_fetch_request() -> None:
engine = _make_engine()
paper = Mock()
with patch(FETCH_SEAM, return_value=[paper]) as fetch:
result = engine._get_search_results("test query")
assert result == [paper]
fetch.assert_called_once_with(
ArxivQueryRequest(
query="test query",
max_results=engine.max_results,
sort_by=ArxivSortCriterion.RELEVANCE,
sort_order=ArxivSortOrder.DESCENDING,
)
)
def test_query_search_propagates_fetch_error() -> None:
engine = _make_engine()
failure = RuntimeError("boom")
with patch(FETCH_SEAM, side_effect=failure):
with pytest.raises(RuntimeError) as exc_info:
engine._get_search_results("test query")
assert exc_info.value is failure
def test_paper_details_uses_id_fetch_request() -> None:
engine = _make_engine()
with patch(FETCH_SEAM, return_value=[_make_detail_paper()]) as fetch:
result = engine.get_paper_details("2101.12345")
assert result["title"] == "Test Paper"
fetch.assert_called_once_with(ArxivIdRequest(arxiv_id="2101.12345"))
def test_paper_details_returns_empty_when_fetch_is_empty() -> None:
engine = _make_engine()
with patch(FETCH_SEAM, return_value=[]):
result = engine.get_paper_details("missing")
assert result == {}
def test_paper_details_preserves_existing_fetch_error_handling() -> None:
engine = _make_engine()
with patch(FETCH_SEAM, side_effect=RuntimeError("boom")):
result = engine.get_paper_details("2101.12345")
assert result == {}