Score an answer
output and expected
Judge compares an output with what you expected. You do not need an agent when you already have both strings.
run returns a result. score is the mark. passed says whether it cleared the bar.
Example
from praisonai.eval import Judge
result = Judge().run(
output="The capital of France is Paris.",
expected="Paris is the capital of France.",
)
print("Score:", result.score)
print("Passed:", result.passed)Example explained
- output — The answer to score.
- expected — What a good answer would say.
- score — The mark the judge gave.
- passed — Whether the mark was high enough.
Expect failure
Eval is useful when wrong answers fail loudly.
Example
from praisonai.eval import Judge
result = Judge().run(
output="London is the capital of France.",
expected="Paris is the capital of France.",
)
print("Passed:", result.passed)Example explained
- from praisonai.eval import Judge — Imports Judge needed for expect failure.
- Judge(…) — Scores an agent reply against explicit quality criteria.
Reference: documentation