~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
"""Observable diagnostics for skipped LLM content blocks."""
import re
from types import SimpleNamespace
import pytest
from local_deep_research.utilities import json_utils
@pytest.fixture
def diagnostics(loguru_caplog):
records = []
sink = json_utils.logger.add(
lambda message: records.append(message.record),
level="DEBUG",
filter=lambda record: record["name"] == json_utils.__name__,
)
try:
yield records
finally:
json_utils.logger.remove(sink)
@pytest.mark.parametrize(
"block",
[
{"type": "tool_use", "text": "ignored block text"},
{"type": "text", "text": 42},
{"unexpected": "ignored block text"},
SimpleNamespace(type="thinking", text="ignored block text"),
SimpleNamespace(text=None),
None,
],
)
def test_skipped_blocks_emit_debug_diagnostics_without_changing_text(
block, diagnostics
):
response = SimpleNamespace(
content=["first", block, {"type": "text", "text": " last"}]
)
assert json_utils.get_llm_response_text(response) == "first last"
assert len(diagnostics) == 1
assert diagnostics[0]["level"].name == "DEBUG"
assert re.search(r"\b1\b", diagnostics[0]["message"])
assert "skipped" in diagnostics[0]["message"].lower()
assert "ignored block text" not in diagnostics[0]["message"]
def test_one_summary_counts_multiple_skipped_blocks(diagnostics):
response = SimpleNamespace(
content=[{"type": "tool_use"}, SimpleNamespace(text=7), "kept"]
)
assert json_utils.get_llm_response_text(response) == "kept"
assert len(diagnostics) == 1
assert re.search(r"\b2\b", diagnostics[0]["message"])
def test_text_only_and_empty_lists_do_not_emit_skip_diagnostics(diagnostics):
response = SimpleNamespace(
content=["a", {"text": "b"}, SimpleNamespace(text="c"), ""]
)
assert json_utils.get_llm_response_text(response) == "abc"
assert json_utils.get_llm_response_text(SimpleNamespace(content=[])) == ""
assert diagnostics == []