Skip to content

开始使用

快速入门

安装引擎,生成项目骨架,并在你自己的机器上完成第一次运行、得到第一个门控决策。除非你主动推送,否则任何数据都不会离开这台机器。

这些步骤取自 README,在此渲染而不是重新输入:README.md 是开发者在 GitHub 上看到的版本,也是入门测试对照代码进行检验的版本,因此它仍是源文件,本页由 scripts/generate_quickstart.py 从它生成。

为开发安装

在仓库根目录下执行:

python3 -m venv .venv
.venv/bin/python -m pip install -e '.[dev]'
pnpm install --frozen-lockfile
make check
pnpm --filter @oloproof/web check

公开的 Python 接口是:

from oloproof import evaluate, system, current_case
from oloproof.evaluators import ExactMatch, Contains, JsonSchema, Regex, RubricJudge, evaluator

oloproof_core 下的所有内容都属于引擎内部实现。

快速开始

生成一个小项目:

. .venv/bin/activate
oloproof init /tmp/oloproof-demo
cd /tmp/oloproof-demo
oloproof run

评估器

oloproof.yaml 接受的 type: 取值:

确定性exact_match、contains、regex、json_schema
LLM 评判模型rubric_judge、groundedness_judge、citation_support_judge; probability_judge:以单个 token 的概率回答的是/否、选择或评分问题;cascade:先用概率评判模型,只在它不确定时才用第二个评判模型
模型model_classifier:运行在 TEI 服务器上的训练好的分类器或 NLI 模型,按阈值打分
检索hit_rate、recall、mrr、ndcg、citation_validity
智能体agent_max_steps、agent_tool_called、agent_no_tool_loop、agent_tool_sequence、agent_no_undeclared_tool、agent_constraints_satisfied
多智能体agent_route、agent_tool_permissions、agent_max_handoffs
预测predictive_correct、predictive_precision、predictive_recall、predictive_ranking、predictive_brier、predictive_log_loss、predictive_absolute_error

评判器需要指定它的 provider(anthropic、openai 或 openai_compatible)、它的 model,以及以 rubric_text 或 rubric_file 给出的评分标准。如果所用的服务商支持 OpenAI API 但并非 OpenAI——例如 Groq、Together 或本地服务器——还需要 base_url 和 api_key_env:

evaluators:
  - type: rubric_judge
    criterion: answer_correct
    provider: openai_compatible
    model: openai/gpt-oss-20b
    base_url: https://api.groq.com/openai/v1
    api_key_env: GROQ_API_KEY
    rubric_text: "PASS if the answer conveys the same fact as the reference."

如果写了评估器不接受的字段,报错会列出它接受的字段。

在不重新运行系统或评估器的情况下,对已有的运行重新做出决策:

oloproof gate RUN_ID --policy release.yaml

查看失败项和单个用例:

oloproof inspect RUN_ID --failures
oloproof inspect RUN_ID --case refund_00

导出证据包并在 Web 工作台中打开:

oloproof export RUN_ID
OLOPROOF_BUNDLE_DIR="$PWD/.oloproof/bundles" pnpm --dir /path/to/Oloproof --filter @oloproof/web dev

证据包路径必须是绝对路径,因为 pnpm 从 apps/web 启动应用。工作台打开时显示其工作区索引;单独设置的 OLOPROOF_BUNDLE_DIR 会以 local/bundles 项目的形式出现在那里。若要在一台机器上管理多个项目,请改为将 OLOPROOF_WORKBENCH_DIR 指向一个包含 workbench.json 的目录(docs/API_CONTRACTS.md)。