Run many requests with detect_batch and adetect_batch
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 30/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
调研方向
Start with the batch result type and failure reporting decision referenced in #126, then review the detector contract and the blocked work in #148, #156, #162, #166, and #169. Implement and check the batch contract across each detector, including concurrency, encoder batching, and the predict_prompt_batch adapters. Done means the listed acceptance criteria and existing tests pass.
由索引模型根据 Issue 内容生成。
描述
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 sends a list of DetectRequest items to any detector and gets one result per request in input order, with the encoder scoring them in padded batches and the LLM-backed detectors running them concurrently under a limit the caller sets. One failed request doesn't throw away the results of the others, reported in the way the batch result decision defines.
The old predict_prompt_batch on every detector becomes an adapter over detect_batch. It keeps today's output, and it keeps raising on the first failure, as today.
Acceptance criteria
-
detect_batch(requests, *, min_score=0.0, include_tokens=False, include_detail=False)andadetect_batchexist on every detector, take any mix ofSourcesInputandPromptInput, and return one result per request in input order. An empty sequence returns an empty result. - The result type and the way a failed request is reported are the ones the batch result decision defines. Whatever it defines, the results of requests that succeeded are returned alongside the failures.
-
EncoderDetectorscores requests in padded groups ofconfig.batch_sizein one forward pass per group, and each result equals the result of a singledetectcall for the same request (includingusagefor that request). - Gathered
adetectcalls andadetect_batchcalls on oneEncoderDetector, single and padded-batch mixed, return the same results as the same requests run one by one (the encoder serialises scoring with its own lock, see task #148). -
LLMJudgeDetectorandGenerativeDetectorrun requests concurrently with at mostconfig.max_concurrencyclient calls in flight per detector instance (max_concurrencydefaults to 30), counted acrossdetect,adetect,detect_batchandadetect_batchtogether, and each result equals the singledetectresult. -
RAGFactCheckerDetectorruns its requests through the same concurrent path, bounded by itsmax_concurrencykeyword on concurrentdetectcalls. -
include_tokens=Trueandinclude_detail=TrueraiseInvalidInputErrorfor the whole batch on detectors that don't support them, before any request runs. -
adetect_batchis a coroutine function that runsdetect_batchin a worker thread and returns an equal result (results, order, per-request failures). It is inherited by every detector, including those that overridedetect_batch. -
adetect_batchleaves the event loop free while it waits. Its whole-batch errors (unsupported flags) come from the awaited call before any request runs, an empty sequence returns an empty result, andmax_concurrencystill bounds in-flight calls, also across gatheredadetect_batchcalls and a batch running next to singledetectoradetectcalls. - The detector contract suite gains a batch section that runs for every detector: order, empty input, equal to single calls,
adetect_batchequal todetect_batch, and the failure reporting once decided. -
predict_prompt_batchonTransformerDetector,LLMDetectorandRAGFactCheckerDetectorcallsdetect_batchand returns today's output (golden fixtures); a failed request raises the first error, as today. - 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.
Blocked by
#148, #156, #162, #166, #169, and the decision elsewhere on the batch result type and failure reporting (see Further Notes in #126).
User stories covered
35, 36, 37, 38, 40, 57
- 主要语言
- Python
- 星标
- 615
- 派生
- 60
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 10
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
KRLabsOrg/LettuceDetect 的其他 Issue
-
Stop-hook --min-confidence drops every --llm-model span (missing confidence treated as 0.0), reporting hallucinated answers as clean可能已有人在做 @Clannad47 于 17 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
KRLabsOrg/LettuceDetect#117 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 1/5 1 小时以内 新手友好度 85/100
KRLabsOrg/LettuceDetect#108 ·
维护者通常 1 天内回复
-
Add AGENTS.md: one entry file for coding agents and new contributors可能已有人在做 @ShryukGrandhi 于 18 天前认领。 未关闭documentation
难度 2/5 半天 新手友好度 70/100
KRLabsOrg/LettuceDetect#104 ·
维护者通常 1 天内回复
-
ready-for-agent
难度 3/5 1-2 天 新手友好度 68/100
KRLabsOrg/LettuceDetect#181 ·
维护者通常 1 天内回复
-
ready-for-agent
难度 5/5 一周以上 新手友好度 22/100
KRLabsOrg/LettuceDetect#180 ·
维护者通常 1 天内回复
查看 KRLabsOrg/LettuceDetect 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
hkust-nlp/Toolathlon#101 ·
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 78/100
SkyTruth/cerulean-cloud#219 ·
-
area:security priority:low size:small
难度 2/5 1-3 小时 新手友好度 84/100
RonaldHensbergen/composable-data-stack#1217 ·
维护者通常 1 天内回复
-
good first issue help wanted
难度 2/5 1-3 小时 新手友好度 88/100
blixvip/BlendClone#27 ·
-
难度 2/5 1-3 小时 新手友好度 74/100