7a0da7932b
Backwards Compatibility / Verify Encryption Constants (push) Waiting to run
Backwards Compatibility / PyPI Version Compatibility (push) Waiting to run
Backwards Compatibility / Database Migration Tests (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Blocked by required conditions
Docker Tests (Consolidated) / detect-changes (push) Waiting to run
Docker Tests (Consolidated) / Build Test Image (push) Waiting to run
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Blocked by required conditions
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Blocked by required conditions
Docker Tests (Consolidated) / Accessibility Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Unit Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / LLM Example Tests (push) Blocked by required conditions
Docker Tests (Consolidated) / Production Image Smoke Test (push) Blocked by required conditions
Docker Tests (Consolidated) / Infrastructure Tests (push) Blocked by required conditions
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Waiting to run
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
186 lines
6.2 KiB
Python
186 lines
6.2 KiB
Python
"""Tests for benchmark API functions."""
|
|
|
|
from unittest.mock import patch
|
|
|
|
|
|
class TestGetAvailableBenchmarks:
|
|
def test_returns_list(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
get_available_benchmarks,
|
|
)
|
|
|
|
result = get_available_benchmarks()
|
|
assert isinstance(result, list)
|
|
|
|
def test_contains_simpleqa(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
get_available_benchmarks,
|
|
)
|
|
|
|
result = get_available_benchmarks()
|
|
ids = [b["id"] for b in result]
|
|
assert "simpleqa" in ids
|
|
|
|
def test_contains_browsecomp(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
get_available_benchmarks,
|
|
)
|
|
|
|
result = get_available_benchmarks()
|
|
ids = [b["id"] for b in result]
|
|
assert "browsecomp" in ids
|
|
|
|
def test_contains_xbench(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
get_available_benchmarks,
|
|
)
|
|
|
|
result = get_available_benchmarks()
|
|
ids = [b["id"] for b in result]
|
|
assert "xbench_deepsearch" in ids
|
|
|
|
def test_benchmarks_have_required_fields(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
get_available_benchmarks,
|
|
)
|
|
|
|
result = get_available_benchmarks()
|
|
for benchmark in result:
|
|
assert "id" in benchmark
|
|
assert "name" in benchmark
|
|
assert "description" in benchmark
|
|
assert "recommended_examples" in benchmark
|
|
|
|
|
|
class TestEvaluateSimpleqa:
|
|
def test_calls_run_benchmark(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
evaluate_simpleqa,
|
|
)
|
|
|
|
with patch(
|
|
"local_deep_research.api.benchmark_functions.run_simpleqa_benchmark"
|
|
) as mock:
|
|
mock.return_value = {"status": "complete"}
|
|
result = evaluate_simpleqa(num_examples=10)
|
|
mock.assert_called_once()
|
|
assert result["status"] == "complete"
|
|
|
|
def test_passes_search_config(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
evaluate_simpleqa,
|
|
)
|
|
|
|
with patch(
|
|
"local_deep_research.api.benchmark_functions.run_simpleqa_benchmark"
|
|
) as mock:
|
|
mock.return_value = {}
|
|
evaluate_simpleqa(search_iterations=5, questions_per_iteration=7)
|
|
call_args = mock.call_args
|
|
assert call_args.kwargs["search_config"]["iterations"] == 5
|
|
assert (
|
|
call_args.kwargs["search_config"]["questions_per_iteration"]
|
|
== 7
|
|
)
|
|
|
|
def test_passes_evaluation_config(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
evaluate_simpleqa,
|
|
)
|
|
|
|
with patch(
|
|
"local_deep_research.api.benchmark_functions.run_simpleqa_benchmark"
|
|
) as mock:
|
|
mock.return_value = {}
|
|
evaluate_simpleqa(
|
|
evaluation_model="gpt-4", evaluation_provider="openai"
|
|
)
|
|
call_args = mock.call_args
|
|
assert (
|
|
call_args.kwargs["evaluation_config"]["model_name"] == "gpt-4"
|
|
)
|
|
assert call_args.kwargs["evaluation_config"]["provider"] == "openai"
|
|
|
|
|
|
class TestEvaluateBrowsecomp:
|
|
def test_calls_run_benchmark(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
evaluate_browsecomp,
|
|
)
|
|
|
|
with patch(
|
|
"local_deep_research.api.benchmark_functions.run_browsecomp_benchmark"
|
|
) as mock:
|
|
mock.return_value = {"status": "complete"}
|
|
result = evaluate_browsecomp(num_examples=10)
|
|
mock.assert_called_once()
|
|
assert result["status"] == "complete"
|
|
|
|
|
|
class TestEvaluateXbenchDeepsearch:
|
|
def test_calls_run_benchmark(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
evaluate_xbench_deepsearch,
|
|
)
|
|
|
|
with patch(
|
|
"local_deep_research.api.benchmark_functions.run_xbench_deepsearch_benchmark"
|
|
) as mock:
|
|
mock.return_value = {"status": "complete"}
|
|
result = evaluate_xbench_deepsearch(num_examples=10)
|
|
mock.assert_called_once()
|
|
assert result["status"] == "complete"
|
|
|
|
|
|
class TestCompareConfigurations:
|
|
def test_returns_dict(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
compare_configurations,
|
|
)
|
|
|
|
with patch(
|
|
"local_deep_research.api.benchmark_functions.run_benchmark"
|
|
) as mock_run:
|
|
with patch(
|
|
"local_deep_research.security.file_write_verifier.write_file_verified"
|
|
):
|
|
mock_run.return_value = {"metrics": {"accuracy": 0.8}}
|
|
result = compare_configurations(num_examples=5)
|
|
assert isinstance(result, dict)
|
|
assert "status" in result
|
|
|
|
def test_uses_default_configurations(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
compare_configurations,
|
|
)
|
|
|
|
with patch(
|
|
"local_deep_research.api.benchmark_functions.run_benchmark"
|
|
) as mock_run:
|
|
with patch(
|
|
"local_deep_research.security.file_write_verifier.write_file_verified"
|
|
):
|
|
mock_run.return_value = {"metrics": {}}
|
|
result = compare_configurations(num_examples=5)
|
|
assert result["configurations_tested"] == 3
|
|
|
|
def test_custom_configurations(self):
|
|
from local_deep_research.api.benchmark_functions import (
|
|
compare_configurations,
|
|
)
|
|
|
|
custom_configs = [
|
|
{"name": "Custom", "search_tool": "wikipedia", "iterations": 2}
|
|
]
|
|
with patch(
|
|
"local_deep_research.api.benchmark_functions.run_benchmark"
|
|
) as mock_run:
|
|
with patch(
|
|
"local_deep_research.security.file_write_verifier.write_file_verified"
|
|
):
|
|
mock_run.return_value = {"metrics": {}}
|
|
result = compare_configurations(
|
|
num_examples=5, configurations=custom_configs
|
|
)
|
|
assert result["configurations_tested"] == 1
|