GitHub Action: rank files in CI
At the end of this page a GitHub Actions workflow will rank a folder of documents, or a file of model outputs, against a rubric each time it runs, and write the ranking, with a range of places for each item, to the job summary. The action runs supposing rank on the runner, so your documents go only to the judge you choose.
Try it with the free judge
Section titled “Try it with the free judge”Add .github/workflows/rank.yml to a repository that has a folder of .md, .txt or .html files, here proposals/:
name: Rank proposalson: [push, pull_request]jobs: rank: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - id: rank with: source: proposals rubric: Which proposal would do the most good per dollar? judge: mock - run: echo "Ranked first, ${{ steps.rank.outputs.top }}. ${{ steps.rank.outputs.summary }}"The mock judge is free and makes up its verdicts (it prefers the text with the higher hidden [[q=...]] score), so you can see the workflow run before you pay for a model. For three proposals the job summary read:
### Supposing ranking
solar.md ranks first, but the best could be any of the first 2.
| Rank | Item | Could be | Wins-losses ||---|---|---|---|| 1 | solar.md | 1-2 | 5-0 || 2 | library.md | 1-2 | 3-2 || 3 | app.md | 2-3 | 0-6 |
8 judge calls, $0.00. Judge checks: Too few comparisons to check the judge's consistency yet: first-shown text wins 38% (too few verdicts to tell).“Could be 1-2” is the range of places at 90% confidence: after 8 calls the judge cannot yet separate the first two, and app.md is not first. The last step printed Ranked first, solar.md. solar.md ranks first, but the best could be any of the first 2.
Use a real judge
Section titled “Use a real judge”Save an OpenRouter key as a repository secret named OPENROUTER_API_KEY, pass it to the step, and cap the spend:
- id: rank env: OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} with: source: proposals rubric: rubric.md judge: quick max-cost: "0.50"rubric is plain words or the path of a .md or .txt file. judge takes quick (the default), economy, balanced, thorough or any OpenRouter model id (Choosing a judge). By default a run makes 8 rounds of comparisons, about 4 judge calls per item; What a run costs turns calls into money. Without a key the step fails and prints the error with what to do:
"code": "provider_unavailable","message": "No OpenRouter key.",Rank model outputs
Section titled “Rank model outputs”source can be a .jsonl, .json or .csv file with one item per row. The text is read from a field named text, output, response, answer or content, and the id from id. To compare the outputs your eval wrote:
with: source: outputs.jsonl rubric: Which answer is more correct and easier to follow? judge: quick args: --both-orders --top-n 3args passes any other supposing rank flag: --text-field output to choose the field, --both-orders to judge each pair in both orders, --top-n 3 to settle only the top three.
Inputs and outputs
Section titled “Inputs and outputs”| Input | Default | What it does |
|---|---|---|
source |
(required) | A folder of .md, .txt and .html files, or a .jsonl, .json or .csv file |
rubric |
(required) | What the judge should prefer, or the path of a .md or .txt file |
judge |
quick |
The judge level, an OpenRouter model id, or mock |
rounds |
8 |
Opponents per item. More rounds, narrower ranges |
max-cost |
none | Hard spend cap in US dollars: no judge call starts that could pass it |
args |
none | Other supposing rank flags |
version |
the action’s tag | The supposing version from PyPI. With @v0.6.4 it is 0.6.4; with a branch or commit, the latest |
| Output | What it holds |
|---|---|
top |
The id of the item ranked first |
summary |
The verdict in one sentence |
result |
The path of the full result as JSON, as supposing rank --json prints it, with every item’s range and the judge checks |
The action installs uv with astral-sh/setup-uv and runs the engine with uvx. The command line sends no usage event in CI (Telemetry).
Why pairs
Section titled “Why pairs”On four public datasets, comparing items in pairs agreed with human ratings or real outcomes more often than the same model scoring each item alone: 86% against 67% on ELLIPSE essays, 73% against 57% on PERSUADE essays, 77% against 71% on Upworthy headlines and 82% against 76% on UKPConvArg arguments. Pairs made more judge calls than scoring alone in each test. The method and the limits are in Pairwise comparison or scoring each item.