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.

Update report_generator.py

LearningCircuit3cd253d6ae96
diff --git a/report_generator.py b/report_generator.py
index 6c89e9c832..45eb0611e4 100644
--- a/report_generator.py
+++ b/report_generator.py
@@ -11,19 +11,21 @@ class ResearchReportGenerator:
def __init__(self):
self.model = ChatOllama(model="deepseek-r1:14b", temperature=0.7)
- def generate_report(self, findings: List[Dict]) -> Dict:
+ def generate_report(self, findings: List[Dict], query : str) -> Dict:
"""Generate a complete research report from findings"""
return {
- "executive_summary": self._generate_executive_summary(findings),
- "main_findings": self._generate_main_findings(findings),
- "detailed_analysis": self._generate_detailed_analysis(findings),
- "confidence_scores": self._generate_confidence_scores(findings),
- "recommendations": self._generate_recommendations(findings)
+ "executive_summary": self._generate_executive_summary(findings, query),
+ "main_findings": self._generate_main_findings(findings, query),
+ "detailed_analysis": self._generate_detailed_analysis(findings, query),
+ "confidence_scores": self._generate_confidence_scores(findings, query),
+ "recommendations": self._generate_recommendations(findings, query)
}
- def _generate_executive_summary(self, findings: List[Dict]) -> str:
+ def _generate_executive_summary(self, findings: List[Dict], query : str) -> str:
all_content = "\n\n".join([f"{f['phase']}: {f['content']}" for f in findings])
prompt = f"""
+ Relate to the user query: {query}
+
Create a concise executive summary of these research findings:
{all_content}
@@ -34,9 +36,11 @@ class ResearchReportGenerator:
response = self.model.invoke(prompt)
return remove_think_tags(response.content).strip()
- def _generate_main_findings(self, findings: List[Dict]) -> List[str]:
+ def _generate_main_findings(self, findings: List[Dict], query : str) -> List[str]:
all_content = "\n\n".join([f"{f['phase']}: {f['content']}" for f in findings])
prompt = f"""
+ Relate to the user query: {query}
+
List the 5 most important main findings from this research:
{all_content}
@@ -51,9 +55,11 @@ class ResearchReportGenerator:
]
return findings_list[:5]
- def _generate_detailed_analysis(self, findings: List[Dict]) -> Dict:
+ def _generate_detailed_analysis(self, findings: List[Dict], query : str) -> Dict:
all_content = "\n\n".join([f"{f['phase']}: {f['content']}" for f in findings])
prompt = f"""
+ Relate to the user query: {query}
+
Analyze these research findings in detail:
{all_content}
@@ -74,9 +80,11 @@ class ResearchReportGenerator:
"uncertainties": [line[12:] for line in content.split('\n') if line.strip().startswith('UNCERTAINTY: ')][:5]
}
- def _generate_confidence_scores(self, findings: List[Dict]) -> Dict:
+ def _generate_confidence_scores(self, findings: List[Dict], query : str) -> Dict:
all_content = "\n\n".join([f"{f['phase']}: {f['content']}" for f in findings])
prompt = f"""
+ Relate to the user query: {query}
+
Evaluate the confidence scores for these research findings:
{all_content}
@@ -108,9 +116,12 @@ class ResearchReportGenerator:
return scores
- def _generate_recommendations(self, findings: List[Dict]) -> List[str]:
+ def _generate_recommendations(self, findings: List[Dict], query : str) -> List[str]:
all_content = "\n\n".join([f"{f['phase']}: {f['content']}" for f in findings])
prompt = f"""
+ Relate to the user query: {query}
+
+
Based on these research findings, provide key recommendations:
{all_content}