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.

made fact checking configurable

LearningCircuit2c500c1e89fc
diff --git a/citation_handler.py b/citation_handler.py
index b23ef631a2..f94c2f5732 100644
--- a/citation_handler.py
+++ b/citation_handler.py
@@ -4,7 +4,7 @@ from langchain_core.documents import Document
from typing import Dict, List, Union, Any
import re
from utilities import remove_think_tags
-
+import config
class CitationHandler:
def __init__(self, llm):
@@ -60,7 +60,7 @@ Provide a detailed analysis with citations and always keep URLS. Example format:
response = self.llm.invoke(prompt)
- return {"content": response.content, "documents": documents}
+ return {"content": remove_think_tags(response.content), "documents": documents}
def analyze_followup(
self,
@@ -85,8 +85,10 @@ Provide a detailed analysis with citations and always keep URLS. Example format:
{formatted_sources}
Return any inconsistencies or conflicts found."""
-
- fact_check_response = remove_think_tags(self.llm.invoke(fact_check_prompt).content)
+ if config.ENABLE_FACT_CHECKING:
+ fact_check_response = remove_think_tags(self.llm.invoke(fact_check_prompt).content)
+ else:
+ fact_check_response = ""
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.
diff --git a/config.py b/config.py
index 03052de32f..d0e430db6c 100644
--- a/config.py
+++ b/config.py
@@ -23,10 +23,13 @@ QUESTIONS_PER_ITERATION = 3
SEARCHES_PER_SECTION = 5
CONTEXT_CUT_OFF = 10000
+# citation handler
+ENABLE_FACT_CHECKING = False # comes with pros and cons.
+
# Search Configuration
MAX_SEARCH_RESULTS = 40 # DuckDuckGoSearch seems to return only 4 results anyways.
-SEARCH_REGION = "us-en"
+SEARCH_REGION = "wt-wt"
TIME_PERIOD = "y"
SAFE_SEARCH = True
SEARCH_SNIPPETS_ONLY = False # both have advantages and disadvantages
diff --git a/full_duck_duck_go_search_results.py b/full_duck_duck_go_search_results.py
index 3258e6a227..55f45e0ca3 100644
--- a/full_duck_duck_go_search_results.py
+++ b/full_duck_duck_go_search_results.py
@@ -52,7 +52,7 @@ class FullDuckDuckGoSearchResults:
for r in results
]
)
-
+ print(urls_text)
now = datetime.now()
current_time = now.strftime("%Y-%m-%d")
prompt = f"""ONLY Return a JSON array. The response contains no letters. Evaluate these URLs for:
@@ -97,7 +97,7 @@ class FullDuckDuckGoSearchResults:
nr_full_text = 0
# Step 1: Get search results from DuckDuckGo
search_results = self.ddg_search.invoke(query)
- print(type(search_results))
+ #print(type(search_results))
if not isinstance(search_results, list):
raise ValueError("Expected the search results in list format.")