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.

feat: simplify TopicOrganizationStrategy and add source snippets

LearningCircuit1d4bc57f7271
diff --git a/src/local_deep_research/advanced_search_system/strategies/topic_organization_strategy.py b/src/local_deep_research/advanced_search_system/strategies/topic_organization_strategy.py
index b96e5dcbcd..07ce0407d7 100644
--- a/src/local_deep_research/advanced_search_system/strategies/topic_organization_strategy.py
+++ b/src/local_deep_research/advanced_search_system/strategies/topic_organization_strategy.py
@@ -106,18 +106,14 @@ Sources:
Identify up to {self.max_topics} distinct topics from these sources.
For each topic:
-1. Provide a clear, descriptive title
-2. Select the source number that best represents this topic (lead source)
-3. List other source numbers that support this topic
-4. Provide 3-5 keywords
+1. Select the source number that best represents this topic (lead source)
+2. List other source numbers that support this topic
Format your response as a JSON list:
[
{{
- "title": "Topic Title",
"lead_source_index": 0,
- "supporting_source_indices": [1, 2, 3],
- "keywords": ["keyword1", "keyword2", "keyword3"]
+ "supporting_source_indices": [1, 2, 3]
}}
]
@@ -165,12 +161,16 @@ Important:
if lead_idx in used_indices or lead_idx >= len(sources):
continue
+ # Use lead source title as topic title
+ lead_source = sources[lead_idx]
+ topic_title = lead_source.get("title", f"Topic {i + 1}")
+
# Create topic
topic = Topic(
id=str(uuid.uuid4()),
- title=topic_info.get("title", f"Topic {i + 1}"),
+ title=topic_title,
lead_source=sources[lead_idx],
- keywords=topic_info.get("keywords", []),
+ keywords=[], # No keywords from LLM anymore
)
used_indices.add(lead_idx)
@@ -541,14 +541,16 @@ Respond with just a number between 0.0 and 1.0.
f"Sources: {len(topic.get_all_sources())} (1 lead + {len(topic.supporting_sources)} supporting)"
)
- # Lead source with link
+ # Lead source with link and snippet
lead = topic.lead_source
lines.append("\n**Lead Source:**")
lines.append(
f"- [{lead.get('title', 'Untitled')}]({lead.get('link', '')})"
)
+ if lead.get("snippet"):
+ lines.append(f" > {lead.get('snippet', '')[:300]}...")
- # All supporting sources with links
+ # All supporting sources with links and snippets
if topic.supporting_sources:
lines.append(
f"\n**Supporting Sources ({len(topic.supporting_sources)}):**"
@@ -557,6 +559,10 @@ Respond with just a number between 0.0 and 1.0.
lines.append(
f"- [{source.get('title', 'Untitled')}]({source.get('link', '')})"
)
+ if source.get("snippet"):
+ lines.append(
+ f" > {source.get('snippet', '')[:200]}..."
+ )
# Related topics
if topic.related_topic_ids: