feat: 诊断(任务书 18 第一块):诊断数学、四种提交、一次运行跑多个实验、账本与材料、flow 诊断各步
消融默认关,关掉时解释阶段一并跳过;选诊断实验用信息价值减成本。 eval/diagnosis/research.json 为第三块配置。vocab 字段说明的出口文字随提示词一起改,见下一次提交的 prompts/ 与同文件改动(本次含在内)。 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -177,6 +177,7 @@ test("写不出来的组合:朴素循环里写开关、规则或它用不到
|
||||
critique: false,
|
||||
firstPrediction: false,
|
||||
roundZero: { enabled: false },
|
||||
diagnosis: { enabled: false },
|
||||
ablation: { enabled: false },
|
||||
batchRule: "uniformRandom",
|
||||
openReserve: 0.1,
|
||||
@@ -200,6 +201,35 @@ test("写不出来的组合:关掉的第零轮写讨论次数、关掉的消
|
||||
assert.match(errorOf(ablation), /^\/flow\/ablation\/cellRule:不认识的字段$/m);
|
||||
});
|
||||
|
||||
/** 诊断开着的完整流程配置。 */
|
||||
function diagnosisConfig(): ReturnType<typeof fullConfig> {
|
||||
const config = fullConfig();
|
||||
(config.flow as Obj).diagnosis = { enabled: true, perResearcher: 2, maxExperiments: 4 };
|
||||
return config;
|
||||
}
|
||||
|
||||
test("诊断:开着的配置通过校验;逐个删字段、写 0、写小数、多写字段都报错;关着的不能写两个参数", () => {
|
||||
assert.deepEqual(checkConfig(structuredClone(diagnosisConfig())), diagnosisConfig());
|
||||
|
||||
for (const key of ["enabled", "perResearcher", "maxExperiments"]) {
|
||||
const config = diagnosisConfig();
|
||||
delete ((config.flow as Obj).diagnosis as Obj)[key];
|
||||
assert.match(errorOf(config), new RegExp(`^/flow/diagnosis/${key}:`, "m"));
|
||||
}
|
||||
const cases: Array<[Obj, RegExp]> = [
|
||||
[{ enabled: true, perResearcher: 0, maxExperiments: 4 }, /^\/flow\/diagnosis\/perResearcher:不能小于 1$/m],
|
||||
[{ enabled: true, perResearcher: 2, maxExperiments: 2.5 }, /^\/flow\/diagnosis\/maxExperiments:应为整数$/m],
|
||||
[{ enabled: true, perResearcher: 2, maxExperiments: 4, rule: "x" }, /^\/flow\/diagnosis\/rule:不认识的字段$/m],
|
||||
[{ enabled: false, perResearcher: 2 }, /^\/flow\/diagnosis\/perResearcher:不认识的字段$/m],
|
||||
[{ enabled: "yes" }, /^\/flow\/diagnosis\/enabled:缺少或取值不对,只能是 false、true 之一$/m],
|
||||
];
|
||||
for (const [diagnosis, expected] of cases) {
|
||||
const config = fullConfig();
|
||||
(config.flow as Obj).diagnosis = diagnosis;
|
||||
assert.match(errorOf(config), expected);
|
||||
}
|
||||
});
|
||||
|
||||
test("写不出来的组合:规则名不在 rules 登记表里", () => {
|
||||
const batch = fullConfig();
|
||||
(batch.flow as Obj).batchRule = "expected-best";
|
||||
|
||||
Reference in New Issue
Block a user