~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
Refactor to use topic_generator.py consistently
LearningCircuit739403c9ea00
diff --git a/src/local_deep_research/news/core/news_analyzer.py b/src/local_deep_research/news/core/news_analyzer.pyindex 787f28eb78..34ea535591 100644--- a/src/local_deep_research/news/core/news_analyzer.py+++ b/src/local_deep_research/news/core/news_analyzer.py@@ -8,7 +8,7 @@ from datetime import datetime, timezonefrom loguru import loggerfrom .utils import generate_card_id-from ..preference_manager.base_preference import TopicRegistry+from ..utils.topic_generator import generate_topicsfrom ...config.llm_config import get_llm@@ -27,17 +27,14 @@ class NewsAnalyzer:def __init__(self,llm_client: Optional[Any] = None,- topic_registry: Optional[TopicRegistry] = None,):"""Initialize the news analyzer.Args:llm_client: LLM client for analysis- topic_registry: Registry for discovered topics"""self.llm_client = llm_client or get_llm()- self.topic_registry = topic_registry or TopicRegistry(self.llm_client)def analyze_news(self, search_results: List[Dict[str, Any]]@@ -333,13 +330,18 @@ PATTERN RECOGNITION (1-2 sentences):""""""topics = []- # Use topic registry to extract from each item+ # Use topic generator to extract from each itemfor item in news_items:- # Combine headline and summary for better topic extraction- content = f"{item.get('headline', '')} {item.get('summary', '')}"-- extracted = self.topic_registry.extract_topics(- content, max_topics=3+ # Use topic generator with headline as query and summary as findings+ headline = item.get("headline", "")+ summary = item.get("summary", "")+ category = item.get("category", "")++ extracted = generate_topics(+ query=headline,+ findings=summary,+ category=category,+ max_topics=3,)for topic in extracted:diff --git a/src/local_deep_research/news/preference_manager/base_preference.py b/src/local_deep_research/news/preference_manager/base_preference.pyindex 79e41a7a3b..885478b1d6 100644--- a/src/local_deep_research/news/preference_manager/base_preference.py+++ b/src/local_deep_research/news/preference_manager/base_preference.py@@ -181,7 +181,7 @@ class TopicRegistry:def extract_topics(self, content: str, max_topics: int = 5) -> List[str]:"""- Extract topics from content using LLM.+ Extract topics from content using topic generator.Args:content: Text content to analyze@@ -190,42 +190,21 @@ class TopicRegistry:Returns:List of extracted topics"""- if not self.llm_client:- logger.warning("No LLM client available for topic extraction")- return []-- try:- prompt = f"""- Extract {max_topics} key topics from this content.- Return only the topic names, one per line.- Make them specific but not too narrow.-- Content: {content[:1000]}- """-- response = self.llm_client.invoke(prompt)- content = (- response.content- if hasattr(response, "content")- else str(response)- )-- # Parse topics from response- topics = [- topic.strip()- for topic in content.strip().split("\n")- if topic.strip()- ][:max_topics]-- # Register discovered topics- for topic in topics:- self.register_topic(topic)-- return topics-- except Exception as e:- logger.error(f"Error extracting topics: {e}")- return []+ from ..utils.topic_generator import generate_topics++ # Use topic generator to extract topics+ topics = generate_topics(+ query="", # No specific query, just analyzing content+ findings=content,+ category="",+ max_topics=max_topics,+ )++ # Register discovered topics+ for topic in topics:+ self.register_topic(topic)++ return topicsdef register_topic(self, topic: str) -> None:"""