关于 cli-eval
cli-eval 介绍用于创建评测套件、针对模型运行测试并查看结果的 OmniRoute 命令行操作,支持实时进度、评分卡、模型比较和 CI 检查。
主要功能
- 01按样本和评分规则创建套件
- 02针对指定模型运行评测
- 03查看实时运行进度
- 04检查结果和评分卡
- 05比较模型得分
- 06在 CI 中使用评测分数
适用场景
- 01依据预期答案评估模型输出
- 02检查评测运行中的失败样本
- 03使用同一套件比较模型
- 04分数低于阈值时使 CI 失败
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ cheaper-inference/ omniroute --skill cli-eval安装后在 Claude Code 中输入/cli-eval确认已加载。
详细介绍
概述
通过命令行创建并运行评估套件、实时查看基准测试进度、查看评分卡、比较模型性能,并将评估运行集成到 CI 工作流中。
快速安装
npm install -g omniroute # or: npx omniroute
omniroute --version
子命令
eval
示例:
omniroute eval
eval suites
示例:
omniroute eval suites
eval list
示例:
omniroute eval list
eval get <suiteId>
示例:
omniroute eval get <suiteId>
eval create
标志:
--file <path>
示例:
omniroute eval create
eval run <suiteId>
标志:
-m, --model <id>--combo <name>--concurrency <n>--tag <tag>--watch
示例:
omniroute eval run <suiteId>
eval list
标志:
--suite <id>--status <s>--since <ts>--limit <n>
示例:
omniroute eval list
eval get <runId>
示例:
omniroute eval get <runId>
eval results <runId>
标志:
--failed
示例:
omniroute eval results <runId>
eval cancel <runId>
标志:
--yes
示例:
omniroute eval cancel <runId>
eval scorecard <runId>
示例:
omniroute eval scorecard <runId>
simulate [prompt]
标志:
--file <path>-m, --model <id>--combo <name>--reasoning-effort <level>--thinking-budget <n>--explain
示例:
omniroute simulate [prompt]
OmniRoute — CLI 评估
需要 omniroute CLI。有关安装和全局标志,请参阅 CLI 入口技能。
什么是评估?
评估是自动化测试套件,用于根据预期答案或评分标准为大模型输出评分。OmniRoute 会将套件和运行结果存储在本地数据库中。
评估套件
omniroute eval suites list # List all eval suites
omniroute eval suites list --json # JSON output
omniroute eval suites get <suiteId> # Full suite definition
创建套件
omniroute eval suites create \
--name "code-quality" \
--rubric "exact-match" \
--samples-file ./samples.jsonl # JSONL: {input, expected_output}
评分标准选项:exact-match、contains、llm-judge、regex。
--samples-file 格式(每行一个 JSON 对象):
{"input": "What is 2+2?", "expected_output": "4"}
{"input": "Translate 'hello' to Spanish", "expected_output": "hola"}
运行评估
omniroute eval suites run <suiteId> \
--model claude-sonnet-4-6 # Run suite against a specific model
omniroute eval suites run <suiteId> \
--model gpt-4o \
--watch # Live TUI progress (EvalWatch)
运行以异步方式进行。使用 --watch 打开实时终端仪表板,或手动轮询:
RUN_ID=$(omniroute eval suites run <suiteId> --model claude-sonnet-4-6 --output json | jq -r '.id')
omniroute eval get $RUN_ID
管理运行
omniroute eval list # List all eval runs
omniroute eval list --json
omniroute eval get <runId> # Run details (status, model, score)
omniroute eval results <runId> # Per-sample results
omniroute eval scorecard <runId> # Full scorecard with pass/fail per sample
omniroute eval cancel <runId> # Cancel a running eval
评分卡输出
omniroute eval scorecard <runId> --output json
每个样本的响应字段:
{
"id": "sample-1",
"score": 0.95,
"passed": true,
"input": "What is 2+2?",
"output": "4",
"expected": "4"
}
比较模型
针对多个模型运行同一套件并进行比较:
for MODEL in claude-sonnet-4-6 gpt-4o gemini-2.0-flash; do
omniroute eval suites run $SUITE_ID --model $MODEL --output json | jq '{model: .model, score: .score}'
done
CI 集成
# Run and fail CI if score drops below threshold
SCORE=$(omniroute eval suites run $SUITE_ID --model claude-sonnet-4-6 --output json | jq -r '.score')
python3 -c "import sys; score=float('$SCORE'); sys.exit(0 if score >= 0.90 else 1)"
错误
suites create报错invalid rubric→ 请使用以下选项之一:exact-match、contains、llm-judge、regexsuites run返回model not found→ 使用omniroute models --search <name>验证模型 IDeval get显示status: failed→ 使用omniroute logs --search eval查看错误详情scorecard返回空结果 → 运行可能仍处于running状态;请轮询omniroute eval get <runId>,直到status为completed
评论
支持 Markdown