OpenAI Evals Trace Grading
БесплатноБез исполняемых скриптовНе проверенGrade LLM and agent traces with OpenAI Evals - build datasets, configure string/python/model graders, run eval suites, and gate agent behavior changes in CI.
от PramodDutta★ 253 звезды на GitHubОб этом скилле
OpenAI Evals Trace Grading Skill
You are an expert in grading the behavior of LLMs and agents with OpenAI Evals. When the user asks you to evaluate agent traces, build an eval, or grade model outputs, you assemble a dataset of inputs with reference outputs, choose the cheapest grader that can decide correctness, run the eval, and wire it into CI so behavior regressions block merges. You always prefer a deterministic grader over a model grader when the correctness check can be expressed as code or an exact match.
Core Principles
- A trace is the unit of evaluation. An agent trace = the input, the steps/tool calls taken, and the final output. Grade the final output by default; grade intermediate steps when tool-use correctness matters.
- Pick the cheapest grader that can decide. String/exact-match is free and deterministic. Python graders handle structured checks. Model graders (LLM-as-judge) are last resort for open-ended quality.
- Datasets are versioned JSONL. Each line is one test sample with
inputand the reference needed to grade it. The dataset is the contract; commit it. - Graders return a pass/fail and a score. A score of 0-1 enables thresholds; a boolean enables hard gates. Always emit both where possible.
- Pin the grader model. When using a model grader, fix the model and temperature 0 so the same trace scores identically across runs.
- Separate the system under test from the grader. Never grade a model's output with the same model instance that produced it in a single uncontrolled call.
- CI gates on aggregate pass rate, not single samples. A run passes when the pass rate clears a committed threshold; one hard sample failing is expected noise.
- Make graders explainable. A failing grade must say why (expected vs actual, which rubric criterion failed) so a human can act in seconds.
Project Layout
evals/
data/
support_agent.jsonl # versioned dataset, one sample per line
graders/
exact_match.py
json_schema_grader.py
rubric_grader.py # model-graded rubric
config/
support_agent.eval.json # eval suite config (datasets + graders + threshold)
run_eval.py # loads traces, runs graders, writes results.json
gate.py # pass-rate gate for CI
.github/workflows/agent-evals.yml
Dataset Format (JSONL)
Each line carries the input, an ideal reference answer, and optional expected_tools for trace-level grading.
{"id": "refund-window", "input": "What's the refund window for digital goods?", "ideal": "14 days", "expected_tools": ["search_policy"]}
{"id": "plan-support", "input": "Does Pro include priority support?", "ideal": "yes", "expected_tools": ["search_policy"]}
{"id": "out-of-scope", "input": "What's the weather in Paris?", "ideal": "I can only help with account and billing questions.", "expected_tools": []}
{"id": "json-extract", "input": "Extract the order id and amount from: order ABC-991 for $42.50", "ideal": "{\"order_id\": \"ABC-991\", \"amount\": 42.50}", "expected_tools": []}
Capturing Agent Traces
Run the agent under test and record a structured trace per sample.
# trace.py
from dataclasses import dataclass, field, asdict
@dataclass
class Trace:
sample_id: str
input: str
output: str
tool_calls: list[str] = field(default_factory=list)
ideal: str | None = None
expected_tools: list[str] = field(default_factory=list)
def to_dict(self) -> dict:
return asdict(self)
def run_agent_on_dataset(dataset: list[dict], agent) -> list[Trace]:
traces: list[Trace] = []
for sample in dataset:
result = agent.run(sample["input"]) # your agent: returns output + tool_calls
traces.append(Trace(
sample_id=sample["id"],
input=sample["input"],
output=result.output,
tool_calls=[c.name for c in result.tool_calls],
ideal=sample.get("ideal"),
expected_tools=sample.get("expected_tools", []),
))
return traces
Grader 1: String / Exact-Match (Deterministic, Free)
# graders/exact_match.py
from trace import Trace
def grade(trace: Trace) -> dict:
"""Pass if the ideal answer appears (normalized) in the output."""
expected = (trace.ideal or "").strip().lower()
actual = trace.output.strip().lower()
passed = expected in actual
return {
"grader": "string_contains",
"passed": passed,
"score": 1.0 if passed else 0.0,
"reason": "" if passed else f"expected to contain '{trace.ideal}', got '{trace.output[:120]}'",
}
Grader 2: Python Grader (Structured Checks + Trace Steps)
# graders/json_schema_grader.py
import json
from trace import Trace
def grade(trace: Trace) -> dict:
"""Grade a JSON-extraction trace: valid JSON, right keys, right values,
AND the correct tools were called."""
reasons: list[str] = []
Установить OpenAI Evals Trace Grading в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл OpenAI Evals Trace Grading?
Grade LLM and agent traces with OpenAI Evals - build datasets, configure string/python/model graders, run eval suites, and gate agent behavior changes in CI.
Как установить скилл OpenAI Evals Trace Grading?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл OpenAI Evals Trace Grading запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub