指南
对另一个工具的分数给出第二意见
你的评测分数上升了。这是真的吗?你能信任度量它的评判模型吗?如果你已经在用另一个工具做评测,就把它在一次改动前后按用例给出的结果导出来,Oloproof 会基于这些结果回答这两个问题,而无需再运行任何东西。
它读取什么
每个系统版本一个文件,格式为 CSV 或 JSON Lines,每个用例和判据各占一行:
| 列 | 内容 |
|---|---|
| case_id | 用例的 id。两个文件只在双方都包含的 id 上配对 |
| criterion | 指标的名称,它会成为规则所指定的指标 |
| score | 指标量表上的一个数值;如果该工具没有给该用例打分,则留空 |
| passed | 用 true 或 false 代替分数,或留空 |
| score_min, score_max | 分数所在的量表(大多数工具为 0 和 1),有分数时必填 |
| judge, judge_version | 做出评判的模型(如果由模型评判)。可选 |
| replicate | 该行是用例的第几次测量,从 1 起的整数,用于把每个用例运行多次的工具(Inspect 的 epoch)。可选;此时每个用例都需要其 replicate 1,用例缺少的 replicate 会使它计为缺失。用例仍是单位:其值是各 replicate 的平均 |
| lower_is_better | 若分数越低越好(例如延迟或成本),填 true。可选。偏好更高分数的规则会被拒绝,第二意见会问它是否下降了 |
除此之外不读取任何内容,任何含有其他列的文件都会被拒绝:文件只包含用例 id 和分数,绝不包含问题、答案或任何其他内容。下面的转换脚本会把每个工具的结果转成这种文件。
运行它
oloproof init --example second-opinion second-opinion
cd second-opinion示例包含一个客服助手在 150 个问题上的忠实度(faithfulness)的两份导出,分别在一次提示词改动之前和之后,由另一个工具的评判模型打分:一个 0 到 1 之间的分数,以及以 0.7 为界的通过或失败。make_exports.py 是写出它们的模拟程序。平均分上升了约 0.02。
oloproof scores import before.csv after.csv --policy release.yamlIs it real?
faithfulness: +0.023, interval [-0.024, +0.068]; no rule decides it.
faithfulness_passed: +5.3 points, interval [-6.9, +18.0].
more-answers-pass (superiority): not established yet
(INSUFFICIENT_EVIDENCE): what measured it has not been checked against
people's labels, so it may not decide.
Can you trust the judge?
faithfulness: not checked yet; people's labels check a pass or fail verdict,
not a score.
faithfulness_passed: not checked yet, so neither result can decide a release.
To check it, label a sample, then measure the judge against the labels:
oloproof review RUN_ID --sample 20 \
--criterion faithfulness_passed --by NAME
oloproof evaluators validate --by NAME \
sha256:d1940ac6b88a394dbe9f0d9650ab28ae826ddcb7a0fc00657ce55df7b70d769f
Details
Imported before.csv from another tool as run RUN_ID: 150 cases, criteria faithfulness, faithfulness_passed.
Imported after.csv from another tool as run RUN_ID: 150 cases, criteria faithfulness, faithfulness_passed.
Second opinion: candidate after.csv against baseline before.csv
Comparison sha256:... of RUN_ID against RUN_ID · 150 paired cases
Reach: inputs like these: the population this suite stands for, as far as it is a fair sample.
faithfulness: +0.023 [-0.024, +0.068] · 150 paired · 0 missing · 0 excluded
faithfulness_passed: +5.3 points [-6.9, +18.0] · 150 paired · 0 missing · 0 excluded
Decisions
more-answers-pass faithfulness_passed superiority INSUFFICIENT_EVIDENCE evaluator_not_validated
Gate: BLOCK (exit 3)
more-answers-pass: the judge (or model or custom evaluator) behind this rule has not been measured against people yet, so it may not decide.
Check it: oloproof review RUN_ID --criterion faithfulness_passed --by YOU
(a blind sample, one line per case; it measures the judge and decides again)每个文件都成为一次运行,两次运行按用例逐一比较。答案分为两半。
- 这是真的吗?还不能确定。分数上升了 0.023,但区间从低 0.024 到高 0.068:只有 150 个问题时,这么小的变化无法与噪声区分开来。评判模型判为通过的答案所占比例上升了 5.3 个百分点,区间从低 6.9 个百分点到高 18.0 个百分点。
- 你能信任这个评判模型吗?还没有人检查过它。release.yaml 只有在人工标签度量过某个评判模型之后才允许它决定发布(require_validated_evaluators: true),因此它的规则在到达区间之前就停在了 evaluator_not_validated。分数在 release.yaml 中没有规则:标签只是通过或不通过,能检查评判模型的结论,却检查不了它的分数,所以分数的规则在 statistics-only.yaml 中。
若要单独查看前一半,就像评判模型已经检查过一样:
oloproof scores import before.csv after.csv --policy statistics-only.yaml score-went-up faithfulness superiority INSUFFICIENT_EVIDENCE interval_overlaps_zero
a suite of about 412 paired cases (262 more) would decide it, if the next pairs go like these; at that size it is settled about half the time
more-answers-pass faithfulness_passed superiority INSUFFICIENT_EVIDENCE interval_overlaps_zero
a suite of about 876 paired cases (726 more) would decide it, if the next pairs go like these (23% of them differing); at that size it is settled about half the time如果这一上升成立,大约 730 个问题就能确立它,而示例只有 150 个。
在 CI 中加上 --summary markdown >> "$GITHUB_STEP_SUMMARY":拉取请求随后以“Is it real?”和每条规则一行开头,写明“not established yet”及其原因,退出码不变。导入本身的输出写到标准错误,因此摘要只收到答案(CI)。
不带 --policy 时,该命令报告比较结果,不作任何决定。只给一个文件时,它报告那次运行,--policy 依据策略中的运行规则对它做门禁。
加上 --html second-opinion.html 并给出两个文件,还会把比较写成一个离线页面,不含用例内容,任何人都能打开。
无需安装任何东西
在 oloproof.com/second-opinion 上选择这两个文件,页面给出的回答与 oloproof scores import before.csv after.csv --policy statistics-only.yaml 相同:每个判据是否确立、它的差异和区间,以及还需要多少用例才能定论,评判模型则标记为未检查,因为上传不带任何标签。每个文件在发送之前都会在你的浏览器中检查,因此含有任何其他列的文件绝不会离开你的机器,而且不保留任何东西:这些运行存放在一个临时存储中,在答案返回之前就被删除。每个文件最多 2 MB、20,000 个分数,查看答案无需账户。网站只保留按结论划分的每日匿名决策计数,背后没有任何地址、Cookie、账户或文件。在答案下方,“生成链接”会把答案本身(每个判据的名称、结论和区间,绝不包括任何文件、用例 ID 或分数)保存在一个不公开列出的地址上 30 天,供同事无需账户即可打开;生成链接的页面在保持打开期间可以删除它。答案是否清楚只有“是”或“否”两种回答,以同样的匿名方式计数;你选择填写的一句话,以及你希望得到回复时留下的邮箱,会由团队阅读,并在 90 天后删除。
该页面也像 --from 一样读取 DeepEval、Braintrust、OpenAI Evals 和 promptfoo 自己的结果文件:在“文件格式”下选择工具,然后原样上传它的两个文件。这类文件包含问题和回答,因此无法在你的浏览器中检查:它会被完整发送,引擎只保留用例 ID 和分数,并在答案返回之前与其余内容一起删除。范围未知的分数(来自某些 OpenAI 评分器)需要使用 CLI 的 --scale。在答案下方,“下载报告”会把比较保存为 oloproof scores import --html 写出的那个离线文件,不含用例内容;它随答案一起生成,不会为此保存任何东西。
检验评判模型
由人对一次导入运行的用例随机抽样打标签,打标签时看不到评判模型的结论,Oloproof 再用这些标签来度量评判模型。为了让他们阅读每个用例而不是它的 id,请让 recipe 同时写出答案,并与导入一起保存:
python recipes/deepeval_results.py results.json before.csv --answers before-answers.jsonl
oloproof scores import before.csv --tool deepeval --answers before-answers.jsonl
oloproof review latest --criterion faithfulness_passed --by NAME答案文件包含每个用例的 case_id、input、expected 和 output(DeepEval、Braintrust、LangSmith、Langfuse 和 OpenAI Evals 的 recipe 用 --answers 写出它;任何包含这些列的 JSON Lines 或 CSV 文件都可以)。它留在你的机器上,永远不会被推送,也不决定任何事情,其中的其他内容,例如工具的分数或结论,都会被略去,因此样本保持盲态。oloproof review 显示每个用例,每个结论一行,然后度量评判模型,在其达到你的策略门槛后予以验证,并重新判定这次运行。没有答案文件时,样本只显示每个用例的 id,打标签的人在保存该用例的工具中查看它。oloproof labels export 则把同一样本写成一张待填写的表格。
标签是通过或失败,因此它们检验的是评判模型的通过或失败结论,而不是它的分数。请把结论与分数一同导入,就像示例中的 faithfulness_passed 那样:这才是人可以验证的判据。
从你已有的计数出发
如果你的工具已经把它的评判模型与人的标签做过比较,无需导入任何东西就可以检验这些数字。Langfuse 自己的示例报告了一个评判模型:人判为通过的 14 个用例中它通过了 13 个(TPR),人判为失败的 21 个用例它全部判为失败(TNR),并建议以 0.90 的门槛将其上线:
oloproof scores judge --counts tp=13,fn=1,fp=0,tn=21 --bar 0.90Can you trust the judge?
35 cases: both passed 13, both failed 21, people passed and the judge failed
1, the judge passed and people failed 0.
The judge agrees with people's labels 97.1%, interval [85.1%, 99.9%] (34 of 35
cases agreed).
Against your bar, minimum_evaluator_agreement 0.90: its low end, 85.1%, does
not clear your bar yet (good faith). To clear it takes at least 36 of 36
labels agreeing.
Bias, the judge's pass rate minus the people's: -2.9 points, interval [-20.0,
+12.6].
Hit rates (information only, not decided)
Passes people passed, the judge passed (TPR): 92.9%, interval [66.1%, 99.8%]
(13 of 14).
Fails people failed, the judge failed (TNR): 100.0%, interval [83.9%, 100.0%]
(21 of 21).
Neither hit rate is read against your bar: three rates against one bar would
be three tests with no multiplicity correction, so only the agreement is.
Good faith: Oloproof did not draw these labels, so this checks your numbers and
does not validate the judge. To validate it, label a sample Oloproof draws, then
measure the judge against those labels:
oloproof review RUN_ID --sample 20 --criterion NAME --by NAME
oloproof evaluators validate --by NAME EVALUATOR_IDtp 是评判模型和人都判为通过的用例,fn 是人判为通过而评判模型判为失败的用例,fp 是评判模型判为通过而人判为失败的用例,tn 是两者都判为失败的用例。一致性为 35 例中 34 例,与 minimum_evaluator_agreement 一样按其下限与你的门槛比较,85.1% 低于 0.90。两个命中率连同其精确区间一起显示,不与门槛比较:它们的下限 66.1% 和 83.9% 也都低于门槛。--bias-bar 0.10 还会读取评判模型的偏差,与 maximum_evaluator_bias 一样。既没有 --bar 也没有 --bias-bar 时,两者都对照引擎的默认门槛 judge_floor@1(一致性 0.70,偏差 0.35)读取,这正是未声明任何门槛的发布策略对评判模型所用的门槛。--labels FILE.csv 读取一个含 judge 列和 label 列(pass 或 fail)、每行一个用例的文件来代替计数,--json 则打印这些数字。它不需要项目,也不存储任何东西。
这个回答属于善意性质:这些标签不是 Oloproof 抽取的,因此它从不据此验证评判模型。末尾的命令才是做验证的命令。
有答案,但没有分数
如果您有系统的答案,但还没有任何工具为它们打分,Oloproof 会自己检查。把同一个答案文件交给它,每个用例附一个期望答案:
oloproof eval answers.jsonl不会重新运行任何东西:每个用例的输出从文件中重放,并按一条声明的规则检查,默认是与 expected 完全一致(--check contains;没有期望答案的输出用 --check regex --pattern RE;--field 检查结构化输出的一个字段)。没有门槛时,它以平实的话结束:通过的比例、它的范围,以及 "No bar set, so nothing was decided." 加上 --policy release.yaml 时,它对运行做出判定,并像 oloproof gate 一样退出。输出就是系统的版本,所以同一个文件再次检查会复用已存的答案,而输出一变就是新版本。--save project 写出用 oloproof run --config project/oloproof.yaml 重现这次运行的 oloproof.yaml(带 --policy 时还有 release.yaml),因此只有在想保留这项检查时才需要写 YAML。--judge RUBRIC --judge-model PROVIDER:MODEL 还会用 LLM 评判模型给每个输出打分(openai_compatible 的评判模型,例如本地模型,用 --judge-base-url);它就是项目自己的评分标准评判模型,因此在人工标签验证它之前,基于它的规则无法通过,--save 会把它保留在项目中。--baseline before.jsonl 在相同的用例上重放第二个回答文件,并像 oloproof compare 那样对两次运行做配对比较;带 --policy 时,由其中的比较规则判定。--json 把同样的判定写成数据。
从你的工具导出
五个工具自己的文件无需转换脚本:--from 直接读取每一个。
oloproof scores import --from deepeval before.json after.json| --from | 它读取的文件 |
|---|---|
| deepeval | DeepEval 保存的结果文件(DisplayConfig(results_folder=...),或 .deepeval/.latest_test_run.json),每个 LLMTestCase 都有名称 |
| braintrust | 一个实验的事件,JSON Lines 格式,每行一个事件,与 experiment.fetch() 返回的一致 |
| openai-evals | 一次运行的输出项,JSON Lines 格式,已下载 |
| promptfoo | promptfoo 的 JSON Lines 格式 --output,每个评分记为 resisted |
| inspect | UK AISI Inspect 的评测日志,即 inspect eval 写出的 .eval 文件或 JSON 日志,含一个或多个 epoch |
每个读取器把文件转成上述文件的行,用例 id 和标准与下面的转换脚本写出的相同,导入检查这些行的方式与检查你自己写的文件完全一样:只有一条路径验证导入的内容,而这些行只携带 id 和分数,从不携带内容。--scale LOW HIGH 说明文件未定的分数范围(OpenAI 模型评分器或 Python 评分器的范围),--judge 在文件未写明时指明做出评判的模型(Braintrust、promptfoo)。其他形式的文件会被拒绝,并指出它缺少的字段。LangSmith 和 Langfuse 把结果放在各自的 API 后面,而不是放在一个文件里,因此仍需使用转换脚本。
Inspect
oloproof scores import --from inspect logs/before.eval logs/after.eval
oloproof scores import --from inspect --scale 1 5 --answers logs/before.eval --answers logs/after.eval logs/before.eval logs/after.eval一个用例就是样本的 id,所以请给数据集里的每个样本一个 id,并在两次运行中保持不变。每个评分器成为一个标准,其值按 Inspect 的读法读取:C 通过,I 不通过,N(无回答)不通过;还会给出 P(部分)的评分器成为 0 到 1 的分数(C 为 1,P 为 0.5,I 和 N 为 0);数字是一个分数,由于日志不说明其范围,需用 --scale LOW HIGH 声明;给出多个值(映射)的评分器每个键给出一个标准,命名为 <scorer>_<key>。出错的样本以空行保留,因此计为缺失,绝不计为通过。各行只携带 id 和分数:输入、目标和输出留在日志中,除非你把同一份日志交给 --answers,它会读取这些内容供你在自己的机器上标注。在含多个 epoch 的日志中,每个 epoch 都是同一个用例的重复,而不是新用例:日志导入为一个含同样数量 replicate 的运行,每个 epoch 一行并带有其 replicate。每个样本的值是其各 epoch 的平均,每个样本权重相同,区间把样本当作单位。判定在每个 epoch 上仍是判定,因此人可以用 oloproof review 标注 epoch,评判模型以样本为单位接受检查。一起导入的两份日志必须有相同数量的 epoch。含有出错的 epoch、其评分器未给出任何值的 epoch,或 epoch 少于其他样本的样本,计为缺失,绝不计为已完成 epoch 的平均。只含一个 epoch 的日志照旧读取。该读取器遵循其源代码在 2026 年 10 月 27 日所描述的 Inspect 日志格式第 2 版,并在这种形状的日志上测试,而不是针对真实运行。
示例的 recipes/ 文件夹为每个工具提供一个简短的脚本。每个脚本读取该工具的结果并写出上述文件,只保留 id 和分数。每个版本运行一次,然后导入这两个文件。
| 工具 | 转换脚本 | 在两次运行之间标识一个用例的是什么 | 说明 |
|---|---|---|---|
| DeepEval | deepeval_results.py RESULTS_JSON OUT | 测试用例的 name | 用 DisplayConfig(results_folder=...) 保存结果,并为每个 LLMTestCase 命名。每个指标给出其分数,并以 <metric>_passed 给出其通过或失败,同时附带评判模型 |
| Braintrust | braintrust_experiment.py PROJECT EXPERIMENT OUT | 实验所运行的数据集记录(origin.id) | 分数在 0 到 1 之间;如果所有分数都由同一个模型评判,用 --judge 指定该模型 |
| LangSmith | langsmith_experiment.py EXPERIMENT OUT --scale LOW HIGH | 数据集示例(reference_example_id) | true 或 false 的分数会变成通过或失败;数值分数需要给出其量表 |
| Langfuse | langfuse_experiment.py EXPERIMENT SINCE OUT | 数据集条目(experiment_item_id) | Langfuse 5 的实验;数值分数采用其分数配置的范围,或用 --scale 指定 |
| OpenAI Evals | openai_evals.py EVAL_ID BEFORE_RUN AFTER_RUN BEFORE_OUT AFTER_OUT,或 --jsonl BEFORE AFTER BEFORE_OUT AFTER_OUT | 两次运行都读取的数据源文件中的行(datasource_item_id) | 一次取两次运行,使用你自己的 OPENAI_API_KEY,或使用它们已下载的输出条目。每个评分器给出其分数,并以 <grader>_passed 给出通过或不通过;模型评分器被记为评判模型;范围未知的分数需要 --scale |
| promptfoo(红队) | promptfoo_redteam.py RESULTS_JSONL OUT | 攻击在生成的 redteam.yaml 中的位置(testIdx、promptIdx) | 它的 --output 采用 JSON Lines 格式;每个评分都会变成 resisted,用于风险上限 |
这些转换脚本遵循各工具在 2026 年 10 月 16 日发布的 SDK(DeepEval 4.3.1、braintrust 0.46.1、langsmith 0.14.11、langfuse 5.0.2),以及 promptfoo 文档在 2026 年 10 月 18 日所描述的 JSON Lines 输出,并在该结构的结果上测试过,而不是针对真实账户。某个工具重命名了字段,坏掉的是它的转换脚本,而不是导入:脚本写出的文件才是契约。
OpenAI Evals,在其关闭之前
OpenAI Evals 将于 2026 年 10 月 31 日变为只读,并于 2026 年 11 月 30 日关闭。趁仍可读取时取下一个 eval 的两次运行,它们的判定之后仍可检验。该配方按每个输出条目所评分的数据源行来配对两次运行,因此两次运行必须读取同一个文件:获取时会检查两者是否指向同一数据源,否则拒绝;样本出错的条目计为缺失。OpenAI 的模型评分器是评判模型,因此在这样的评分器可以用于门禁之前,人们标注的是 <grader>_passed。
它依据 2026 年 10 月 22 日的 OpenAI API 参考编写,并在该形状的条目上测试过,而非针对真实账号:仍欠一次在只读月份内用真实账号进行的检查。把两个文件复制到同一个文件夹;无需其他任何东西。
# recipes/openai_evals.py
"""OpenAI Evals: two runs' output items, as Oloproof's scores files.
Each output item names the row of the run's data source it graded (`datasource_item_id`, its
place in that file), so two runs pair case by case only when they read the same file. Fetching
checks that both runs name the same source and refuses otherwise; downloaded JSON Lines cannot be
checked, so make sure of it yourself. Each grader becomes two criteria: its score, and its pass
or fail as `<grader>_passed`, the verdict people can label. A model grader (`score_model`,
`label_model`) is a judge, named in the file, and is validated against people's labels before it
gates. A score from a grader whose range is not known (a model or Python grader's) needs
`--scale LOW HIGH`. An item whose sample errored is left out, so it counts as missing.
python recipes/openai_evals.py EVAL_ID BEFORE_RUN AFTER_RUN before.csv after.csv
python recipes/openai_evals.py --jsonl before.jsonl after.jsonl before.csv after.csv
With `--answers before-answers.jsonl after-answers.jsonl` it also writes each run's answers for
`oloproof scores import --answers`: the sample's input messages, the text of its output messages,
and, with `--expected-field NAME`, that field of the data source row (its keys are your own, so
none is assumed). Never a grader's score or verdict.
Fetching uses your own OPENAI_API_KEY and reads nothing but the two runs and their output items.
Written on 22 October 2026 from OpenAI's API reference, not against a live account:
https://developers.openai.com/api/reference/python/resources/evals/subresources/runs/subresources/output_items/methods/list.md
https://developers.openai.com/api/reference/python/resources/evals/subresources/runs/methods/retrieve.md
Evals becomes read-only on 31 October 2026 and shuts down on 30 November 2026
(https://developers.openai.com/api/docs/deprecations): fetch your runs before then.
"""
from __future__ import annotations
import json
import os
import re
import sys
import urllib.parse
import urllib.request
from collections.abc import Iterable
from pathlib import Path
from answers_file import answer_row, write_answers
from scores_file import score_row, verdict_row, write
API = "https://api.openai.com/v1"
#: Graders whose score has a known range; any other needs --scale.
RANGES = {"string_check": (0.0, 1.0), "text_similarity": (0.0, 1.0)}
JUDGES = {"score_model", "label_model"}
def criterion(name: str) -> str:
return re.sub(r"[^a-z0-9]+", "_", name.lower()).strip("_")
def rows(items: Iterable[dict], scale: tuple[float, float] | None = None) -> list[dict]:
out = []
for item in items:
if item.get("datasource_item_id") is None:
raise SystemExit(f"output item {item.get('id')} names no datasource_item_id")
case_id, status = str(item["datasource_item_id"]), item.get("status")
if status == "error" or ((item.get("sample") or {}).get("error") or {}).get("code"):
continue
if status not in ("pass", "fail"):
raise SystemExit(
f"output item {item.get('id')} has status {status!r}, not pass or fail"
)
for result in item.get("results") or []:
if not result.get("name") or not isinstance(result.get("passed"), bool):
raise SystemExit(f"output item {item.get('id')} has a result with no name or pass")
name, kind = criterion(result["name"]), result.get("type")
judge = kind if kind in JUDGES else None
if result.get("score") is not None:
low_high = RANGES.get(kind) or scale
if low_high is None:
raise SystemExit(f"{name} ({kind}) has no known range: state --scale LOW HIGH")
out.append(score_row(case_id, name, float(result["score"]), low_high, judge))
out.append(verdict_row(case_id, f"{name}_passed", result["passed"], judge))
return out
def answers(items: Iterable[dict], expected_field: str | None = None) -> list[dict]:
"""Each graded item's input and output from its sample, and nothing a grader decided."""
out = []
for item in items:
sample = item.get("sample") or {}
if item.get("status") == "error" or (sample.get("error") or {}).get("code"):
continue
output = "".join(m.get("content") or "" for m in sample.get("output") or [])
row = item.get("datasource_item") or {}
expected = row.get(expected_field) if expected_field else None
out.append(
answer_row(str(item["datasource_item_id"]), sample.get("input"), output, expected)
)
return out
def get(path: str, query: dict | None = None) -> dict:
url = f"{API}{path}" + (f"?{urllib.parse.urlencode(query)}" if query else "")
headers = {"Authorization": f"Bearer {os.environ['OPENAI_API_KEY']}"}
with urllib.request.urlopen(urllib.request.Request(url, headers=headers)) as response:
return json.load(response)
def fetch(eval_id: str, run_id: str) -> list[dict]:
items, query = [], {"limit": 100}
while True:
page = get(f"/evals/{eval_id}/runs/{run_id}/output_items", query)
items.extend(page["data"])
if not page.get("has_more"):
return items
query = {"limit": 100, "after": page["last_id"]}
def same_source(eval_id: str, before: str, after: str) -> None:
sources = [
get(f"/evals/{eval_id}/runs/{run}")["data_source"]["source"] for run in (before, after)
]
if sources[0].get("type") not in ("file_id", "file_content") or sources[0] != sources[1]:
raise SystemExit(
"the two runs do not read the same data source file; their rows do not pair"
)
def read_jsonl(path: str) -> list[dict]:
items = []
for line in Path(path).read_text(encoding="utf-8").splitlines():
if line.strip():
record = json.loads(line)
items.extend(record["data"] if record.get("object") == "list" else [record])
return items
if __name__ == "__main__":
args, scale = sys.argv[1:], None
if "--scale" in args:
at = args.index("--scale")
scale = (float(args[at + 1]), float(args[at + 2]))
del args[at : at + 3]
answer_paths, expected_field = None, None
if "--answers" in args:
at = args.index("--answers")
answer_paths = args[at + 1 : at + 3]
del args[at : at + 3]
if "--expected-field" in args:
at = args.index("--expected-field")
expected_field = args[at + 1]
del args[at : at + 2]
if args[0] == "--jsonl":
runs = [read_jsonl(args[1]), read_jsonl(args[2])]
else:
same_source(*args[:3])
runs = [fetch(args[0], args[1]), fetch(args[0], args[2])]
found = [rows(items, scale) for items in runs]
if not all(found):
raise SystemExit("a run holds no graded output item; nothing was written")
for each, target in zip(found, args[-2:], strict=True):
write(each, target)
if answer_paths is not None:
for items, target in zip(runs, answer_paths, strict=True):
write_answers(answers(items, expected_field), target)# recipes/scores_file.py
"""The one file `oloproof scores import` reads, written from rows the recipes beside this build.
Each recipe turns one tool's results into rows of `case_id`, `criterion`, then `score` with its
`score_min` and `score_max`, or `passed`, and optionally the `judge`. Nothing else goes in: a row
never carries the question, the answer or any other content.
"""
from __future__ import annotations
import csv
from collections.abc import Iterable
from pathlib import Path
COLUMNS = ["case_id", "criterion", "score", "passed", "score_min", "score_max", "judge"]
def score_row(
case_id: str, criterion: str, value: float, scale: tuple[float, float], judge: str | None
) -> dict:
low, high = scale
return {
"case_id": case_id,
"criterion": criterion,
"score": value,
"score_min": low,
"score_max": high,
"judge": judge or "",
}
def verdict_row(case_id: str, criterion: str, passed: bool, judge: str | None) -> dict:
return {
"case_id": case_id,
"criterion": criterion,
"passed": "true" if passed else "false",
"judge": judge or "",
}
def write(rows: Iterable[dict], path: str | Path) -> None:
with Path(path).open("w", newline="", encoding="utf-8") as handle:
writer = csv.DictWriter(handle, fieldnames=COLUMNS)
writer.writeheader()
writer.writerows(rows)文件必须做对的事
- 只出现在一个文件中的用例,在另一侧计为缺失,会被计数并按最坏情况界定;它绝不会与另一个用例配对。
- 同一用例和判据的第二行、超出 score_min 和 score_max 的分数、同时带有分数和通过或失败的行,以及在一个文件中是分数、在另一个文件中是通过或失败的判据,都会被拒绝,并指出是哪一行。
- 被比较的文件必须在每个判据的量表和评判模型上一致:来自两个评判模型的分数是两件测量仪器,它们的差异有一部分会来自仪器本身。
- 每个文件都是一个由其内容标识的系统版本。再次导入同一个文件会复用已存储的内容;从不执行任何东西,因此任何重新运行都无法重现或改变一个导入的分数。
- --tool 记录分数的来源,--name 为每个文件的系统命名;两者都随运行一起保存。
尚未构建的功能
- 不借助 SDK 读取 LangSmith 或 Langfuse 的结果:由它们的转换脚本获取。--from 读取 DeepEval、Braintrust、OpenAI Evals、promptfoo 和 Inspect 的文件。
- 验证评判模型的分数,而不是它的通过或失败结论。
这无法告诉你的
- 有关内容的任何信息。文件只包含用例 ID 和分数,从不包含问题或回答,所以除非你用 scores import --answers 保留回答,Oloproof 无法看到用例为何得到该分数。
- 分数再来一次是否相同。不执行任何东西:没有重新运行能重现或改变导入的分数。
- 评判模型的分数是否正确。它的通过或不通过结论可以与人工标签对照检查;它的分数目前还不能。
- 更换评判模型是否改变了分数。两个文件必须为每个标准写明相同的评判模型和量表;评判模型或量表不同的文件会被拒绝,而不是被比较。
所有评估都无法告诉你的内容见单独的页面。
下一步
- 将候选与基线进行比较:配对比较读取的是什么。
- 比较规则:优效、非劣效和等效。
- 评判模型:评判模型在获准做门禁之前如何与人对照度量。