Add RAGFactCheckerDetector.detect with injected fact checker and merge fix
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
- 52/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend-api-design, testing
Direzione di ricerca
Start with tests/test_golden_rag_fact_checker_pytest.py and lettucedetect/detectors/rag_fact_checker.py; first run the provided pytest command and inspect the #130 merge fixture. Implement the injected fact checker path, detection outputs, span text correction, and shared concurrency bound described in the steps. Done means the acceptance criteria pass, including async and batch behavior, without reading the environment on the injected path.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Parent: #169 · Epic: #126 · Blocked by: #130, #143
Branch from stateless_core; open the PR against it.
Problem
RAGFactCheckerDetector can't be tested or used without building RAGFactChecker from an API key, ignores misspelt keyword arguments, has no detect, and can return a span whose text is not the text at its offsets.
Current behavior
lettucedetect/detectors/rag_fact_checker.py:17-40constructor buildsRAGFactCheckerand swallows**kwargs.:155_convert_to_spans:confidence0.9 (:192) and 0.7 for partial matches (:211).:220_merge_overlapping_spanssetsend = max(...)(:237) but keeps the first span'stext.
Steps
- Constructor becomes
RAGFactCheckerDetector(openai_api_key=None, model="gpt-4o", base_url=None, temperature=0.0, *, fact_checker=None, max_concurrency=30, **kwargs). Withfact_checker, nothing is built and the environment isn't read; without it, buildRAGFactCheckeras today (document this exception:RAGFactCheckeris outside this package).model_id = model. - Implement
_detectforSourcesInputandPromptInput.scoreis today'sconfidence(0.9 full, 0.7 partial); add onesynthetic_scorewarning when there is any span. - After merging, set the span's
texttoanswer[start:end]. Update the merge fixture from #130 as an intended change, called out in the PR. include_tokens=TrueraisesInvalidInputError(tokens_not_supported).usage: one entry,model_version=None, unitssources,source_chars,answer_chars.max_concurrencyis a named keyword (so**kwargsdoesn't swallow it); below 1 raisesConfigurationError(invalid_config, parammax_concurrency). The constructor creates onethreading.BoundedSemaphore(max_concurrency), and_detectholds it for the whole fact-check call, because the LLM calls happen insideRAGFactCheckerand can't be counted from outside.detect,adetectand the batch methods therefore share the bound on concurrentdetectcalls.
Acceptance criteria
-
detectspans equal #130"spans"output withscore= oldconfidence; merged-span text equals the answer between offsets. -
await adetect(...)equalsdetect(inherited, in a worker thread); an injected fact checker is called from that thread only. - With
max_concurrency=2and many concurrentdetectandadetectcalls on one detector, a counting fake fact checker is never called by more than 2 at once;max_concurrency=0raisesConfigurationError(invalid_config, parammax_concurrency); the default is 30. - Passes the contract suite with a fake fact checker; the injected path touches no environment.
- Existing tests pass; follows CONTRIBUTING "Errors and logging".
Start here
uv run --extra dev pytest tests/test_golden_rag_fact_checker_pytest.py -q
- Lingua principale
- Python
- Stelle
- 615
- Fork
- 60
- Merge medio
- 1g 8h
- PR unite (30g)
- 10
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di KRLabsOrg/LettuceDetect
-
Stop-hook --min-confidence drops every --llm-model span (missing confidence treated as 0.0), reporting hallucinated answers as cleanForse già presa @Clannad47 l’ha presa 18 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
KRLabsOrg/LettuceDetect#117 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
KRLabsOrg/LettuceDetect#108 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 Mezza giornata Idoneità per principianti 70/100
KRLabsOrg/LettuceDetect#104 ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-agent
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
KRLabsOrg/LettuceDetect#181 ·
I maintainer di solito rispondono entro 1 giorno
-
ready-for-agent
Difficoltà 5/5 Più di una settimana Idoneità per principianti 22/100
KRLabsOrg/LettuceDetect#180 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di KRLabsOrg/LettuceDetect
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
pylint-dev/pylint#11791 ·
I maintainer di solito rispondono entro 1 giorno
-
Rasterio granule reads never retry, so one 503 (Service Unavailable) fails the whole requestForse già presa @chuckwondo l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
developmentseed/titiler-cmr#305 ·
I maintainer di solito rispondono entro 1 giorno
-
community enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno