Return triplets via include_detail and route predict* through detect

Aperta
#171 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, pytorch

Direzione di ricerca

Start with lettucedetect/detectors/rag_fact_checker.py and run the two pytest files listed under “Start here.” Then read the detector contract and the #130 fixtures, along with the dependency issues #169 and #170. Done means detect exposes the specified detail structure, legacy predict methods preserve fixture behavior, and the contract and existing tests pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

ready-for-agent

Parent: #169 · Epic: #126 · Blocked by: #170
Branch from stateless_core; open the PR against it.

Problem

The triplets and fact-check results are reachable only through the "detailed" output format. The predict* methods carry their own copy of the logic, which can drift from detect.

Current behavior

  • lettucedetect/detectors/rag_fact_checker.py:41-89 predict builds "detailed" as a dict; :133 _convert_to_tokens builds fixed tokens (0.9 / 0.1); spans carry a triplet key; :90 predict_prompt; :102 predict_prompt_batch.

Steps

  1. Set supports_detail = True. include_detail=True returns Detection.detail as DetailedResult: triplets (answer, context, hallucinated), fact_check_results, and span_triplets (each span's source triplet or None, parallel to spans). Without it detail is None.
  2. predict ("spans", "tokens", "detailed") and predict_prompt call detect and convert back: the triplet key on each span, tokens built from the triplets as today, "detailed" dict built from detail.
  3. Old methods raise InvalidInputError (unsupported_output_format, length_mismatch, invalid_min_score). predict_prompt_batch unchanged until #178.

Acceptance criteria

  • predict* equals the #130 fixtures (apart from the merge-text fix from #170).
  • detail structure tested against a fake fact checker; include_tokens=True still raises.
  • Contract suite passes; existing tests pass; follows CONTRIBUTING "Errors and logging".

Start here

uv run --extra dev pytest tests/test_golden_rag_fact_checker_pytest.py tests/test_benchmark_detectors_pytest.py -q
Lingua principale
Python
Stelle
615
Fork
60
Merge medio
1g 8h
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di KRLabsOrg/LettuceDetect

Tutte le issue di KRLabsOrg/LettuceDetect

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.