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

匯出證據包並在網頁工作台中開啟:

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)。