p3: blind titles, cap snippets, equalise k; abort cached dumps
Exempt title from the vendor-token check. Truncate snippets to 160 chars and clip all four packs to the same per-query k. run.py fails cached replies with a rerun message instead of a config mismatch.
This commit is contained in:
@@ -108,6 +108,8 @@ def sift_one(base: str, key: str, query: str, k: int, timeout: float) -> dict:
|
||||
def check_sources(config: str, rows: list[dict]) -> str | None:
|
||||
want = EXPECTED_SOURCES[config]
|
||||
for i, row in enumerate(rows):
|
||||
if row.get("cached"):
|
||||
return f"query {i}: cached, rerun after the hour or change k"
|
||||
sizes = row.get("sizes") or {}
|
||||
ok = sizes.get("sources_ok") or []
|
||||
failed = sizes.get("sources_failed") or []
|
||||
@@ -228,6 +230,10 @@ def self_test() -> int:
|
||||
bad = check_sources("searxng_brave", rows)
|
||||
if not bad:
|
||||
raise AssertionError("mismatch not caught")
|
||||
cached_rows = [{**rows[0], "cached": True, "sizes": {}}]
|
||||
msg = check_sources("searxng", cached_rows)
|
||||
if not msg or "cached, rerun after the hour or change k" not in msg:
|
||||
raise AssertionError(msg)
|
||||
ht = hermes_tavily_one(host + "/search", "k", "one", 8, 5)
|
||||
if ht["data"]["web"][0]["description"] != "snippet":
|
||||
raise AssertionError(ht)
|
||||
|
||||
Reference in New Issue
Block a user