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.

added open ai endpooint and minor optimizations

LearningCircuit020399b1e906
diff --git a/config.py b/config.py
index d6c216c883..1e1ef317c9 100644
--- a/config.py
+++ b/config.py
@@ -45,8 +45,11 @@ load_dotenv()
# Choose search tool: "serp" or "duckduckgo" (serp requires API key)
search_tool = "auto" # Change this variable to switch between search tools; for only local search "local-all"
-KNOWLEDGE_ACCUMULATION = KnowledgeAccumulationApproach.QUESTION # None doesnt work with detailed report
+KNOWLEDGE_ACCUMULATION = KnowledgeAccumulationApproach.QUESTION # None doesnt work with detailed report. It basically means the questions are seperate on the topic.
# LLM Configuration
+OPENAIENDPOINT=False # True + URL + Model Name
+OPENROUTER_BASE_URL= "https://openrouter.ai/api/v1"
+
DEFAULT_MODEL = "mistral" # try to use the largest model that fits into your GPU memory
DEFAULT_TEMPERATURE = 0.7
MAX_TOKENS = 15000
@@ -100,7 +103,12 @@ def get_llm(model_name=DEFAULT_MODEL, temperature=DEFAULT_TEMPERATURE):
return ChatAnthropic(
model=model_name, anthropic_api_key=api_key, **common_params
)
-
+ elif OPENAIENDPOINT:
+ api_key = os.getenv("OPENAI_ENDPOINT_API_KEY")
+ if not api_key:
+ raise ValueError("OPENAI_API_KEY not found in environment variables")
+ return ChatOpenAI(model=model_name, api_key=api_key,openai_api_base=OPENROUTER_BASE_URL, **common_params)
+
elif "gpt" in model_name:
api_key = os.getenv("OPENAI_API_KEY")
if not api_key:
diff --git a/search_system.py b/search_system.py
index 495c7cdee2..8e2cc5cdef 100644
--- a/search_system.py
+++ b/search_system.py
@@ -77,7 +77,7 @@ class AdvancedSearchSystem:
now = datetime.now()
current_time = now.strftime("%Y-%m-%d")
if self.questions_by_iteration:
- prompt = f"""First provide a high-quality long explanation based on sources (Date today: {current_time}). Keep citations and source link directly in text position. Never make up sources. Than provide a exact high-quality one sentence-long answer to the query.
+ prompt = f"""First provide a high-quality 1 page explanation based on sources (Date today: {current_time}). Keep citations and source link directly in text position. Never make up sources. Than provide a exact high-quality one sentence-long answer to the query.
Knowledge: {current_knowledge}
Query: {query}
diff --git a/utilties/search_utilities.py b/utilties/search_utilities.py
index 155c4146f2..b0cbadca24 100644
--- a/utilties/search_utilities.py
+++ b/utilties/search_utilities.py
@@ -30,10 +30,10 @@ def extract_links_from_search_results(search_results: list) -> list:
def format_findings_to_text(findings_list, current_knowledge, questions_by_iteration):
- formatted_text = "COMPLETE RESEARCH OUTPUT\n\n"
+ formatted_text = "COMPLETE RESEARCH OUTPUT \n\n"
# Store the full current knowledge
- formatted_text += "FULL ACCUMULATED KNOWLEDGE:\n"
+
formatted_text += f"{current_knowledge}\n\n"
formatted_text += "=" * 80 + "\n\n"