~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
Add community benchmark results API - Fixes #540
Devansh KM7f308b8e57d2
diff --git a/src/local_deep_research/api/client.py b/src/local_deep_research/api/client.pyindex 0dcd7a3b14..4bea2374c6 100644--- a/src/local_deep_research/api/client.py+++ b/src/local_deep_research/api/client.py@@ -59,6 +59,7 @@ import requestsimport timefrom typing import Optional, Dict, Any, Listfrom loguru import logger+from local_deep_research.benchmarks.comparison.results import Benchmark_resultsclass LDRClient:@@ -374,6 +375,76 @@ class LDRClient:self.logged_in = Falseself.username = None+ def submit_benchmark(+ self,+ model,+ hardware,+ accuracy_focused,+ accuracy_source,+ avg_time_per_question,+ context_window,+ temperature,+ ldr_version,+ date_tested,+ notes="",+ ):+ """+ Submit your benchmark results to help the community.++ Args:+ model: Model name (e.g., "Llama-3.3-70B-Q4_K_M")+ hardware: Hardware specs (e.g., "RTX 4090 24GB")+ accuracy_focused: Accuracy percentage for focused strategy+ accuracy_source: Accuracy percentage for source-based strategy+ avg_time_per_question: Average time per question in seconds+ context_window: Context window size used+ temperature: Temperature setting used+ ldr_version: Version of LDR used (e.g., "0.6.0")+ date_tested: Date tested (YYYY-MM-DD format)+ notes: Optional notes about the test++ Returns:+ True if submission was successful++ Example:+ client.submit_benchmark(+ "Llama-3.3-70B-Q4_K_M", "RTX 4090 24GB",+ 87.0, 82.0, 45.2, 32000, 0.1, "0.6.0", "2024-01-15"+ )+ """+ benchmarks = Benchmark_results()+ return benchmarks.add_result(+ model,+ hardware,+ accuracy_focused,+ accuracy_source,+ avg_time_per_question,+ context_window,+ temperature,+ ldr_version,+ date_tested,+ notes,+ )++ def get_benchmarks(self, best_only=False):+ """+ Get community benchmark results.++ Args:+ best_only: If True, only return top performers++ Returns:+ List of benchmark results++ Example:+ all_results = client.get_benchmarks()+ top_results = client.get_benchmarks(best_only=True)+ """+ benchmarks = Benchmark_results()+ if best_only:+ return benchmarks.get_best()+ return benchmarks.get_all()+def __enter__(self):"""Support context manager for auto-cleanup."""return selfdiff --git a/src/local_deep_research/benchmarks/comparison/__init__.py b/src/local_deep_research/benchmarks/comparison/__init__.pyindex e492cfc803..62fd1b7d95 100644--- a/src/local_deep_research/benchmarks/comparison/__init__.py+++ b/src/local_deep_research/benchmarks/comparison/__init__.py@@ -8,7 +8,11 @@ parameters, models, and search engines.from local_deep_research.benchmarks.comparison.evaluator import (compare_configurations,)+from local_deep_research.benchmarks.comparison.results import (+ Benchmark_results,+)__all__ = ["compare_configurations",+ "Benchmark_results",]diff --git a/src/local_deep_research/benchmarks/comparison/results.py b/src/local_deep_research/benchmarks/comparison/results.pynew file mode 100644index 0000000000..53fd940a7e--- /dev/null+++ b/src/local_deep_research/benchmarks/comparison/results.py@@ -0,0 +1,65 @@+import json+++class Benchmark_results:+ def __init__(self):+ self.results_file = "benchmark_results.json"+ self.results = self._load_results()++ def add_result(+ self,+ model,+ hardware,+ accuracy_focused,+ accuracy_source,+ avg_time_per_question,+ context_window,+ temperature,+ ldr_version,+ date_tested,+ notes="",+ ):+ # add a new benchmark result, as noted by issue+ result = {+ "model": model,+ "hardware": hardware,+ "accuracy_focused": accuracy_focused,+ "accuracy_source": accuracy_source,+ "avg_time_per_question": avg_time_per_question,+ "context_window": context_window,+ "temperature": temperature,+ "ldr_version": ldr_version,+ "date_tested": date_tested,+ "notes": notes,+ }++ self.results.append(result)+ self._save_results()+ return True++ def get_all(self):+ # Getting all benchmark results+ return self.results++ def get_best(self, sort_by="accuracy_focused"):+ """get best performing models"""+ if sort_by == "avg_time_per_question":+ return sorted(+ self.results, key=lambda x: x["avg_time_per_question"]+ )+ else:+ return sorted(self.results, key=lambda x: x[sort_by], reverse=True)++ def _load_results(self):+ # Load results from file++ try:+ with open(self.results_file, "r") as f:+ return json.load(f)+ except FileNotFoundError:+ return []++ def _save_results(self):+ # Save results to file.+ with open(self.results_file, "w") as f:+ json.dump(self.results, f, indent=2)