mirror of
https://github.com/lllin000/PaperForge.git
synced 2026-07-22 17:00:23 +00:00
- Add evidence_query class to build_query_plan() for intent='evidence' - Add ocr_evidence_available to enrich_query_plan_with_runtime() - Add OCR evidence enrichment in search.py and retrieve.py - Add routing contract tests (3 routing + 1 evidence hit) - All pre-existing tests pass
29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
|
|
def test_evidence_query_routes_to_ocr_evidence_search() -> None:
|
|
from paperforge.query_planning import build_query_plan
|
|
|
|
plan = build_query_plan("electric field parameters mammalian cells", "evidence")
|
|
|
|
assert plan["query_class"] == "evidence_query"
|
|
assert plan["recommended_primary"]["command"] in ("ocr-evidence", "search")
|
|
assert "evidence" in str(plan.get("suggested_modes", [])).lower() or "ocr" in str(plan.get("suggested_modes", [])).lower()
|
|
|
|
|
|
def test_metadata_query_still_routes_to_search() -> None:
|
|
from paperforge.query_planning import build_query_plan
|
|
|
|
plan = build_query_plan("Lin 2024 electrical stimulation", "discover")
|
|
|
|
assert plan["query_class"] != "evidence_query"
|
|
assert plan["recommended_primary"]["command"] == "search"
|
|
|
|
|
|
def test_vague_content_query_still_routes_to_retrieve() -> None:
|
|
from paperforge.query_planning import build_query_plan
|
|
|
|
plan = build_query_plan("how do cells respond to electric fields", "content")
|
|
|
|
assert plan["query_class"] != "evidence_query"
|
|
assert plan["recommended_primary"]["command"] == "retrieve"
|