diff --git a/tests/test_qa_quality_live.py b/tests/test_qa_quality_live.py index b633a31..57c0632 100644 --- a/tests/test_qa_quality_live.py +++ b/tests/test_qa_quality_live.py @@ -141,6 +141,24 @@ def test_mona_lisa_grounded_and_names_leonardo(): f"answer missing 'Leonardo': {_answer_lower(r)[:200]}" +# ---------------------------------------------------------------- retrieval disambiguation + + +def test_red_fish_blue_fish_identifies_seuss_book(): + """Stress-tests retrieval disambiguation: "red fish blue fish" partially + matches many noise titles (Red Dwarf, Blue whale, Toronto Blue Jays, + Red Sea, Detroit Red Wings, marine aquarium fish list...). The right + answer is the Dr. Seuss book ``One Fish Two Fish Red Fish Blue Fish``. + The model should anchor on the Seuss article and the answer should + contain a Seuss-specific token.""" + r = _ask("plot of red fish blue fish?") + assert _grounded(r), f"audit_mode={r.get('audit_mode')!r}" + txt = _answer_lower(r) + seuss_markers = ("seuss", "rhyming", "children's book", "creatures") + assert any(m in txt for m in seuss_markers), \ + f"answer missing Seuss-book markers: {txt[:300]}" + + # ---------------------------------------------------------------- entity disambiguation