Skip to content

~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.

minor changes

LearningCircuit9033d492c210
diff --git a/src/local_deep_research/advanced_search_system/strategies/iterdrag_strategy.py b/src/local_deep_research/advanced_search_system/strategies/iterdrag_strategy.py
index d64b3a02fc..9b2f38c9dc 100644
--- a/src/local_deep_research/advanced_search_system/strategies/iterdrag_strategy.py
+++ b/src/local_deep_research/advanced_search_system/strategies/iterdrag_strategy.py
@@ -150,29 +150,14 @@ Initial Search Results:
self.findings_repository.set_questions_by_iteration({0: sub_queries})
if not sub_queries:
- # If no sub-queries generated, try to answer directly
- self._update_progress(
- "No sub-queries generated, attempting direct answer",
- 25,
- {"phase": "direct_answer"},
- )
-
- try:
- result = self.citation_handler.analyze_initial(query, initial_results)
- if result is not None:
- finding = {
- "phase": "Direct answer",
- "content": result["content"],
- "question": query,
- "search_results": initial_results,
- "documents": result["documents"],
- }
- findings.append(finding)
- self.findings_repository.add_finding(query, finding["content"])
- self.findings_repository.add_documents(result["documents"])
- current_knowledge = result["content"]
- except Exception as e:
- logger.error(f"Error during direct answer: {str(e)}")
+ logger.error("No sub-queries were generated to analyze.")
+ finding = {
+ "phase": "Analysis Error",
+ "content": "No sub-queries could be generated for the main question.",
+ "question": query,
+ "search_results": [],
+ }
+ findings.append(finding)
else:
# Process each sub-query
total_subqueries = len(sub_queries)
@@ -261,18 +246,14 @@ Initial Search Results:
try:
# Extract finding contents for synthesis
- finding_contents = [
- finding.get("content", "")
- for finding in findings
- if finding.get("content")
- ]
+ finding_contents = [f["content"] for f in findings if "content" in f]
+ # Synthesize findings into a final answer
final_answer = self.findings_repository.synthesize_findings(
- query,
- sub_queries,
- finding_contents, # Pass list of finding contents
+ query, sub_queries, finding_contents
)
+ # Create a synthesis finding
finding = {
"phase": "Final synthesis",
"content": final_answer,
@@ -281,17 +262,15 @@ Initial Search Results:
"documents": [],
}
findings.append(finding)
- # Store the *raw synthesized content* associated with the main query
- self.findings_repository.add_finding(
- query + "_synthesis", finding["content"]
- )
- current_knowledge = (
- final_answer # Update knowledge with the *synthesized* version
- )
+ # Store the synthesized content
+ self.findings_repository.add_finding(query + "_synthesis", final_answer)
+
+ # Update current knowledge with the synthesized version
+ current_knowledge = final_answer
except Exception as e:
logger.error(f"Error synthesizing final answer: {str(e)}")
- # If synthesis fails, keep existing knowledge, maybe add error note?
+ # If synthesis fails, keep existing knowledge
final_answer = current_knowledge # Fallback to pre-synthesis knowledge
# Compress knowledge if needed
@@ -312,24 +291,20 @@ Initial Search Results:
)
try:
- # Use the final_answer (synthesized content) and original findings list
+ # Format the findings using the repository's formatting method
formatted_findings = self.findings_repository.format_findings_to_text(
- findings, final_answer # Pass original findings and synthesized content
+ findings, final_answer
)
- # Add the formatted findings to the repository (using a distinct name if needed)
- # self.findings_repository.add_finding(query + "_formatted", formatted_findings)
except Exception as e:
logger.error(f"Error formatting final findings: {str(e)}")
- formatted_findings = (
- "Error: Could not format final findings due to an error."
- )
+ formatted_findings = "Error: Could not format findings due to an error."
self._update_progress("Research complete", 100, {"phase": "complete"})
return {
"findings": findings, # Keep the detailed findings list
"iterations": 1,
- "questions": {"0": sub_queries},
+ "questions": self.questions_by_iteration, # Use the member variable instead of {"0": sub_queries}
"formatted_findings": formatted_findings, # This is the fully formatted string for UI
"current_knowledge": current_knowledge, # This is the synthesized content for knowledge base
}
diff --git a/src/local_deep_research/search_system.py b/src/local_deep_research/search_system.py
index 1be4caf42f..c9178b5a4f 100644
--- a/src/local_deep_research/search_system.py
+++ b/src/local_deep_research/search_system.py
@@ -12,7 +12,7 @@ logger = logging.getLogger(__name__)
class AdvancedSearchSystem:
- def __init__(self, strategy_name: str = "standard"):
+ def __init__(self, strategy_name: str = "iterdrag"):
"""
Initialize the advanced search system.