from pydantic_evals import Case, Dataset
from pydantic_evals.evaluators import IsInstance, LLMJudge
dataset = Dataset(
cases=[
Case(
name='refund_policy',
inputs='Can I return this after 40 days?',
expected_output='No, the return window is 30 days.',
),
],
evaluators=[
IsInstance(type_name='str'),
LLMJudge(rubric='States the 30-day window, invents no exception.'),
],
)
report = dataset.evaluate_sync(answer_question)
pydantic-evals works with any Python you can call, not only Pydantic AI, and a custom scorer is an ordinary function. Because the suite
is code, it is reviewed in pull requests and runs in CI beside your other tests.
Note what this means: Logfire does not run your evals. You run them, with your credentials and your data, and Logfire records
the experiment, stores every case-level result, and gives you the history and the comparison over it.