Skip to content

Pin today's RAGFactCheckerDetector output with golden fixtures #130

Closed

Description

@hslev

Parent: #127 · Epic: #126 · Blocked by: #128 (only for tests/golden.py)
Work on branch 127-record-golden-fixtures-*; commit the changes and close the ticket.

Problem

RAGFactCheckerDetector gains detect, and one of its defects is fixed (a merged span's text can be shorter than its offsets). The old output must be recorded first.

Current behavior

  • lettucedetect/detectors/rag_fact_checker.py:41 predict ("tokens", "spans", "detailed"), :90 predict_prompt, :102 predict_prompt_batch.
  • Tokens: :133 _convert_to_tokens (prob 0.9 / 0.1, :149). Spans: :155 _convert_to_spans (confidence 0.9 at :192, 0.7 for single-word matches at :211).
  • :220 _merge_overlapping_spans extends end (:237) but keeps the first span's text.
  • The constructor builds a RAGFactChecker and ignores unknown kwargs (:17-40), so tests use a fake fact checker set on the instance.

Steps

  1. Add tests/test_golden_rag_fact_checker_pytest.py with a fake fact checker returning fixed triplets and results.
  2. Record "tokens", "spans" and "detailed" output.
  3. Add a triplet matched only by single words (score 0.7).
  4. Add a case where merging overlapping spans leaves a span whose text is shorter than end - start.

Acceptance criteria

Start here

uv run --extra dev pytest tests/test_benchmark_detectors_pytest.py -q

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions