Skip to main content
defineEval 是编写评估用例的主要入口。每个评估用例文件调用一次,传入描述和 test(t),并默认导出结果。
不要提供 idnameNiceEval 从文件路径推导评估用例 ID。

defineEval 选项

description

一句话描述,展示在 niceeval list 和 view 里;纯说明,不影响调度或打分。

tags

标签,供 CLI --tag 过滤和 view 分类;与 id 前缀过滤是两套独立的筛选维度。

sandbox

这道题贡献的 Sandbox 声明层。省略等价于空 command-only layer,不提供隐式 template。 每个实际 Eval x Experiment 配对必须恰好一方提供 template-bearing layer。

plugins

Explicit, immutable Eval Plugin occurrences; no directory inheritance exists.

judge

声明 Judge capability;true 继承 Experiment/Config,对象同时声明并覆盖它们。

reporters

覆盖 / 追加项目级 Config.reporters,只对这一条评估用例生效。

timeoutMs

覆盖项目级 / CLI 的单次 attempt 超时(毫秒),只对这一条评估用例生效。

metadata

任意附加元数据,作为 Attempt Provenance 保存,不参与调度或打分;供自定义 reporter 消费。

diff

调整 agent diff 的归因排除清单(仅 Sandbox 型;见 docs/feature/eval/README.md):两个数组都是 gitignore 风格 glob(workdir 相对)。默认排除 .git/node_modules/构建产物/包管理器缓存; ignore 在默认清单上追加排除;include 优先级最高,把匹配路径显式加回。 合成规则固定为「默认 ∪ ignore,再被 include 打洞」,清单在分类账锚点时冻结。

test

Test context: t

tTestContext)是评估用例作者拿到的高层上下文。每一次作者入口调用都直接登记一条 Assertion。t.check(value, match) 严格接收两个参数。t.succeeded()session.succeeded()turn.succeeded()calledTool(...)notCalledTool(...) 与 Judge recipe 也直接登记 Assertion。handle 只配置同一条 entry 的 keylabel.atLeast(n).score(n).orStop() 也只作用于此 entry,绝不登记第二条 Assertion。 Pass Eval 用 Boolean condition 折叠 Attempt Verdict。measurement 必须 .atLeast(n)await handle.orStop() 在 mismatch 或 below 时停止当前 continuation。defineScoreEvalScoreTestContext 额外提供 t.score(n) 直接登记 contribution,n 必须 finite 且不小于零;已有 Assertion 用 .score(n) 贡献分数,n 必须 finite 且大于零。calledToolnotCalledTool 的完整契约见 Scoped assertions。全部成员:

evaluationKind

send

sendFile

requireInputRequest

respond

respondAll

reply

sessionId

events

newSession

signal

model

reasoningEffort

flags

progress

diagnostic

log

skip

group

check

sandbox

o11y

usage

succeeded

usedNoTools

maxToolCalls

noFailedActions

event

notEvent

maxTokens

maxCost

judge

Judge measurement

先在 defineEvaldefineScoreEval 声明 judge: true,再直接登记 Judge Assertion:
t.judge.autoevals 的根级 recipe 额外接收 { input, output } 字符串材料。turn.judge 已绑定 immutable Turn 材料。模型配置按 Eval、Experiment、项目配置解析一次;没有单次模型覆盖或 { on } 选项。Pass Eval 必须 .atLeast(n);Score Eval 直接 .score(n)

Turn 返回类型

t.send(...) 返回一个 TurnHandle:从事件流派生的便利字段,加上一整套本轮作用域断言。 calledToolnotCalledTool 也属于 Turn 的作用域断言;它们的签名和 Match 规则只在 Scoped assertions 定义。

events

toolCalls

status

message

data

usage

succeeded

toolOrder

usedNoTools

maxToolCalls

noFailedActions

event

notEvent

eventOrder

maxTokens

maxCost

judge

测试集导出

数组导出会生成稳定 ID:file/0000file/0001 等。 已有稳定业务 key 时也可以默认导出 Record<string, EvalDef>。例如 key 15193swelancer.eval.ts 中生成 swelancer/15193。key 必须是非空单一路径片段,不能是 . / ..,不能含 /\\ 或控制字符。发现顺序按 key 字典序固定。