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 output improvments

LearningCircuite5973ab8641f
diff --git a/citation_handler.py b/citation_handler.py
index 52634f8cd7..63d982220c 100644
--- a/citation_handler.py
+++ b/citation_handler.py
@@ -72,7 +72,7 @@ Provide a detailed analysis with citations and always keep URLS. Example format:
documents = self._create_documents(search_results)
formatted_sources = self._format_sources(documents)
- prompt = f"""Using the previous knowledge and new sources, answer the question. Include citations using numbers in square brackets [1], [2], etc. When citing, use the source number provided at the start of each source. Always keep URLS.
+ prompt = f"""Using the previous knowledge and new sources, answer the question. Include citations using numbers in square brackets [1], [2], etc. When citing, use the source number provided at the start of each source. Always keep URLS. Reflect information from sources critically.
Previous Knowledge:
{previous_knowledge}
@@ -81,8 +81,8 @@ Question: {question}
New Sources:
{formatted_sources}
-
-Provide a detailed answer with citations. Example format: "According to [1], ..."
+Reflect information from sources critically.
+Provide a detailed answer with citations. Example format: "According to [1], ..."
"""
response = self.llm.invoke(prompt)
diff --git a/search_system.py b/search_system.py
index ac3d7c9a91..56cf74fce0 100644
--- a/search_system.py
+++ b/search_system.py
@@ -1,12 +1,14 @@
from typing import Dict, List
from datetime import datetime
-from utilities import remove_think_tags, format_findings_to_text
+from utilities import remove_think_tags, format_findings_to_text, print_search_results
import os
from config import get_llm, get_search, SEARCH_ITERATIONS, QUESTIONS_PER_ITERATION
from citation_handler import CitationHandler
from datetime import datetime
+
+
class AdvancedSearchSystem:
def __init__(self):
self.search = get_search()
@@ -70,6 +72,8 @@ class AdvancedSearchSystem:
if len(search_results) == 0:
continue
+ print_search_results(search_results) # only links
+
result = self.citation_handler.analyze_followup(
question, search_results, limited_knowledge
)
diff --git a/utilities.py b/utilities.py
index f47118aa64..7facf2a618 100644
--- a/utilities.py
+++ b/utilities.py
@@ -95,3 +95,13 @@ def format_findings_to_text(findings_list, current_knowledge, questions_by_itera
formatted_text += "\n" + "=" * 80 + "\n"
return formatted_text
+
+def print_search_results(search_results):
+ formatted_text=""
+ links = extract_links_from_search_results(search_results)
+ if links:
+ formatted_text += "SOURCES USED IN THIS SECTION:\n"
+ for i, link in enumerate(links, 1):
+ formatted_text += f"{i}. {link['title']}\n URL: {link['url']}\n"
+ formatted_text += "\n"
+ print(formatted_text)