Run the LLM judge through LLMJudgeDetector
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 30/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- ai, backend-api-design
Direzione di ricerca
Start by reading the parent issue #126, the blocked issues #127, #140 and #144, and the Errors and logging section of CONTRIBUTING.md. Then inspect the existing LLMDetector judge path, client implementations, cache helpers, and detector contract and golden tests to map the required behavior. Done means LLMJudgeDetector passes the stated contract, the judge path delegates to it, and the existing tests pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Parent
#126
Branch
Branch from stateless_core and open the pull request against it, not main. Close this ticket by hand once its pull request merges there: GitHub only closes issues automatically on merges into main.
What to build
A service developer passes an LLM client and a model id to LLMJudgeDetector and gets Detection results from the zero-shot or few-shot judge, with reasoning, taxonomy and the verify pass as config options. A failed call is visible: an unparseable reply raises UpstreamError instead of reading as "no hallucination found", the clients raise typed errors, and every degraded step (an unlocated item, a skipped verification) says so in warnings. The detector caches only when the caller passes a ResponseCache.
The judge path of LLMDetector delegates to LLMJudgeDetector from this task on, so there is one implementation; LLMDetector's own warnings and argument handling come in task #166.
Acceptance criteria
-
LLMJudgeDetector(client, model, *, config=None, cache=None, model_version=None)builds no client, reads no environment variable and writes no file (apart from acachethe caller passed); itsmodel_idismodel. -
LLMJudgeConfighas the fields and defaults in the epic. An unknown option raisesConfigurationError(invalid_config), an unknown language raises it withinvalid_language, and afewshot_paththat doesn't exist raises it withfewshot_not_found, each with itsparam. -
detectandadetectaccept aSourcesInputand aPromptInputand locate each item in the answer as today (first unused verbatim match, no overlaps).textequals the answer between the offsets, and the output matches the golden fixtures once spans withoutconfidencecarry score 1.0. -
adetectis inherited, not overridden: it returns a result equal todetectfor both request kinds, runs the client call, the cache access and the verify pass in one worker thread off the event loop, raises the same errors (UpstreamError,ConfigurationError) from the awaited call, and gatheredadetectcalls on one detector return their own results in call order. - One
threading.BoundedSemaphore(config.max_concurrency)per detector instance wraps each client call (the verify call included) and nothing else. Withmax_concurrency=2and many concurrentdetectandadetectcalls, a counting fake client never sees more than 2 calls in flight and every call gets its own result.max_concurrencybelow 1 raisesConfigurationError(invalid_config, paramconfig.max_concurrency). -
scoreis the model'sconfidencewithinclude_reasoning=True, and 1.0 otherwise, in which case theDetectionhas exactly onesynthetic_scorewarning.category,subcategoryandreasoningare set as today, everyinclude_taxonomyform works, andLLMJudgeConfig.min_scoreis applied before the verify pass while the call'smin_scoreis applied to the final spans. - An item that can't be located is dropped with the warning
span_not_found, and an item that is neither a string nor an object withtextis dropped withitem_malformed. An item the model rejected itself is dropped without a warning. No answer text appears in a message or on a module logger. - A reply that is not JSON, lacks
hallucination_listor has it as something other than a list raisesUpstreamError(unparseable_response). - With
verify=Truerejected spans are dropped; a verification reply that can't be parsed keeps the first-pass spans, addsverification_skippedand logsfallback_usedwith that code at WARNING. -
OpenAIClientraisesConfigurationError(authentication_failed,quota_exceeded) for authentication and quota errors andUpstreamError(upstream_unavailable) for timeouts, connection errors, rate limits and server errors, chained withraise ... from.BedrockClientraisesUpstreamError(empty_response) when the reply has no tool call. A caller's ownLLMClienterrors propagate unwrapped. - The detector uses the cache's sync methods from the worker thread, so
adetecthas the same hit, write-after-parse and delete-on-unparseable behaviour asdetect, and concurrentadetectcalls lose no cache key. - With a
cache, the keys come frommake_cache_key(kinds"judge"and"verify") withmodel_version; a hit makes no client call; a reply is written only after it parses; a cached entry that doesn't parse is deleted and the call raisesUpstreamError(unparseable_response). -
usagehas one entry withmodel_id,model_versionand the unitsllm_calls(calls actually made, the verify call included),cache_hits,source_charsandanswer_chars. -
LLMJudgeDetectorpasses the detector contract suite with a fake client. - The judge path of
LLMDetectordelegates toLLMJudgeDetectorand itspredict*output equals the golden fixtures, apart from spans that had noconfidencenow carrying 1.0 (a recorded, intended change). - The existing tests pass unchanged.
- The changed code follows the Errors and logging section of
CONTRIBUTING.md, and no customer text is logged outsidelettucedetect.content(the raw reply included).
Blocked by
#127, #140, #144
User stories covered
3, 4, 5, 7, 8, 17, 19, 21, 22, 23, 24, 26, 29, 34, 40, 47, 50, 57
- 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
-
LLVM versionsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
Translate docs/ to SpanishApertadocumentation good first issue language
Difficoltà 2/5 1-3 ore Idoneità per principianti 91/100
-
good first issue help wanted translation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Fix duplicated word in speculative decoding docsForse già presa @ddlw l’ha presa oggi. Apertacommunity-request
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 89/100
NVIDIA/Megatron-LM#9118 ·
I maintainer di solito rispondono entro 2 giorni