~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(exploration): handle list-form LLM query output (#5395)
Ziyang Guoa1827885dde5
diff --git a/changelog.d/4615.bugfix.md b/changelog.d/4615.bugfix.mdnew file mode 100644index 0000000000..f8eeb0b7e2--- /dev/null+++ b/changelog.d/4615.bugfix.md@@ -0,0 +1 @@+Handle list-form LLM content blocks when candidate explorers generate follow-up search queries.diff --git a/src/local_deep_research/advanced_search_system/candidate_exploration/adaptive_explorer.py b/src/local_deep_research/advanced_search_system/candidate_exploration/adaptive_explorer.pyindex 13d092ea0b..556c8ead2b 100644--- a/src/local_deep_research/advanced_search_system/candidate_exploration/adaptive_explorer.py+++ b/src/local_deep_research/advanced_search_system/candidate_exploration/adaptive_explorer.py@@ -13,6 +13,7 @@ from loguru import loggerfrom ..candidates.base_candidate import Candidatefrom ..constraints.base_constraint import Constraint+from ...utilities.json_utils import get_llm_response_textfrom .base_explorer import (BaseCandidateExplorer,ExplorationResult,@@ -247,7 +248,7 @@ Query:"""try:- response = self.model.invoke(prompt).content.strip()+ response = get_llm_response_text(self.model.invoke(prompt)).strip()return response if response != base_query else Noneexcept Exception as e:logger.debug(@@ -276,7 +277,7 @@ Related search term:"""try:- response = self.model.invoke(prompt).content.strip()+ response = get_llm_response_text(self.model.invoke(prompt)).strip()return response if response != base_query else Noneexcept Exception as e:logger.debug(diff --git a/src/local_deep_research/advanced_search_system/candidate_exploration/parallel_explorer.py b/src/local_deep_research/advanced_search_system/candidate_exploration/parallel_explorer.pyindex af6e235f0b..c579cd905d 100644--- a/src/local_deep_research/advanced_search_system/candidate_exploration/parallel_explorer.py+++ b/src/local_deep_research/advanced_search_system/candidate_exploration/parallel_explorer.py@@ -12,6 +12,7 @@ from typing import List, Optionalfrom loguru import loggerfrom ...database.thread_local_session import thread_cleanup+from ...utilities.json_utils import get_llm_response_textfrom ..candidates.base_candidate import Candidatefrom ..constraints.base_constraint import Constraintfrom .base_explorer import (@@ -205,7 +206,7 @@ Format as numbered list:4. [query]"""- response = self.model.invoke(prompt).content.strip()+ response = get_llm_response_text(self.model.invoke(prompt)).strip()# Parse numbered listqueries = []diff --git a/tests/advanced_search_system/test_list_content_coercion.py b/tests/advanced_search_system/test_list_content_coercion.pyindex 6b57b79eda..8c3b043300 100644--- a/tests/advanced_search_system/test_list_content_coercion.py+++ b/tests/advanced_search_system/test_list_content_coercion.py@@ -225,3 +225,47 @@ class TestBaseExplorerListContent:assert isinstance(names, list)assert "Marie Curie" in namesassert not any("'type'" in n or "[{" in n for n in names)+++class TestCandidateQueryGenerationListContent:+ """Candidate explorer query-generation sites missed by #4644."""++ @staticmethod+ def _adaptive_explorer(text):+ from local_deep_research.advanced_search_system.candidate_exploration.adaptive_explorer import (+ AdaptiveExplorer,+ )++ model = Mock()+ model.invoke.return_value = _list_content_response(text)+ return AdaptiveExplorer(model=model, search_engine=Mock())++ def test_adaptive_synonym_query_extracts_text_block(self):+ explorer = self._adaptive_explorer("alternative terminology")++ query = explorer._synonym_expansion_query("original term")++ assert query == "alternative terminology"++ def test_adaptive_related_query_extracts_text_block(self):+ explorer = self._adaptive_explorer("adjacent topic")++ query = explorer._related_terms_query("original term", [])++ assert query == "adjacent topic"++ def test_parallel_variations_extract_text_block(self):+ from local_deep_research.advanced_search_system.candidate_exploration.parallel_explorer import (+ ParallelExplorer,+ )++ model = Mock()+ model.invoke.return_value = _list_content_response(+ "1. first query\n2. second query"+ )+ explorer = ParallelExplorer(model=model, search_engine=Mock())++ assert explorer._generate_query_variations("original") == [+ "first query",+ "second query",+ ]