Add GenerativeDetector with GenerativeConfig and typed spans
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
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- ai, backend-api-design
Direzione di ricerca
Start with lettucedetect/detectors/llm.py and run uv run --extra dev pytest tests/test_llm_detector_pytest.py -q -k native. Follow the shared parsing, locating, cache, and concurrency code described in the issue and inspect the #129 native fixtures. Done means the new detector matches those fixtures with scored spans, supports both request kinds, and passes the listed configuration, error, and concurrency criteria.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Parent: #162 · Epic: #126 · Blocked by: #158, #129
Branch from stateless_core; open the PR against it.
Problem
The fine-tuned generative models are served by the same class as the judge, chosen by a substring in the model name, with spans that never carry a score and an empty or garbage reply read as "no hallucination found".
Current behavior
lettucedetect/detectors/llm.py:26_looks_native(model)guesses from the name;:121-125raisesValueErrorifnativeis combined withzero_shot,fewshot_pathorprompt_path.llm.py:437_predict_nativeuses the frozen generative prompt, thengen.spans_to_offsets(answer, gen.parse_spans(cached or ""))(:479): a reply without JSON or withouthallucinated_spansyields no spans.
Steps
- Add
GenerativeConfig(frozen pydantic,extra="forbid"):temperature=0.0,lang="en"(used by the verify prompt),include_reasoning=False,include_taxonomy=False(same four forms),verify=False,max_concurrency=30.zero_shot,fewshot_path,prompt_pathare not fields →ConfigurationError(invalid_config) withparam; unknown language →invalid_language.max_concurrencybelow 1 →invalid_config(paramconfig.max_concurrency). - Add
GenerativeDetector(client, model_id, *, config=None, cache=None, model_version=None)— builds no client, reads no environment, writes no file. _detectfor both request kinds with the frozen prompt. Spans areDetectedSpanwithcategory/subcategoryfrom the reply andreasoningfromexplanationwheninclude_reasoning=True. Located in the answer as the judge does (share the helper).- Every span has
score1.0 and theDetectionhas exactly onesynthetic_scorewarning. - Unlocated item →
span_not_found; malformed item →item_malformed. Reply that is not JSON, lackshallucinated_spans, or has a non-list →UpstreamError(unparseable_response). - Concurrency bound: the same per-instance
threading.BoundedSemaphore(config.max_concurrency)as #158 step 8, taken only around each client call (share the code). The verify call (#164) takes it too. - Same implementation note as #158 step 9: keep
_detectthin, with the pure parsing, locating and verify-merging steps shared with the judge and I/O only at the cache read, the client call and the cache write or delete.
Acceptance criteria
- Output equals the #129 native fixtures except spans carry score 1.0 (intended change, in the PR description).
-
await adetect(...)equalsdetectfor both request kinds, withadetectinherited and the same errors coming out of theawait. - With
max_concurrency=2and many concurrentdetectandadetectcalls on one detector, a counting fake client never sees more than 2 calls in flight;max_concurrency=0raisesConfigurationError(invalid_config, paramconfig.max_concurrency). - All custom taxonomy forms work; passing a judge-only option raises as above.
- No answer text in messages or non-content loggers.
- Contract suite passes with a fake client; existing tests pass; follows CONTRIBUTING "Errors and logging".
Start here
uv run --extra dev pytest tests/test_llm_detector_pytest.py -q -k native
- Lingua principale
- Python
- Stelle
- 615
- Fork
- 60
- Merge medio
- 2g 18h
- PR unite (30g)
- 12
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
-
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
-
Bugs: One typed detect interface for the detectors packageForse già presa @hslev l’ha presa 1 giorno fa. Aperta
KRLabsOrg/LettuceDetect#192 · 1 assegnatario ·
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
-
question
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
vllm-project/vime#524 ·
I maintainer di solito rispondono entro 7 giorni
-
WOPI editor page is scrollable by a few pixels, which breaks scrolling in the document (Firefox)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
suitenumerique/drive#969 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
theupdateframework/python-tuf#3044 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
FAIRmat-NFDI/pynxtools#861 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
NVIDIA/nsight-python#88 ·
I maintainer di solito rispondono entro 1 giorno