指南
對另一個工具的分數提出第二意見
你的評測分數上升了。這是真的嗎?你能信任量測它的評審嗎?如果你已經在用另一個工具做評測,就把它在一次變更前後逐案例的結果匯出,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 無法看到案例為何得到該分數。
- 分數再來一次是否相同。不執行任何東西:沒有重新執行能重現或改變匯入的分數。
- 評審的分數是否正確。它的通過或不通過結論可以與人工標籤比對檢查;它的分數目前還不能。
- 更換評審是否改變了分數。兩個檔案必須為每個標準寫明相同的評審和量表;評審或量表不同的檔案會被拒絕,而不是被比較。
所有評估都無法告訴你的內容見單獨的頁面。
下一步
- 將候選版本與基準比較:配對比較讀取的是什麼。
- 比較規則:優越性、不劣性與等效性。
- 評審:評審在可以設閘把關之前,如何與人比對量測。