Score a reply

Compare two strings

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='Refunds under $50 are approved within 30 days of delivery.',
    expected='Refunds under $50 are eligible within 30 days.',
)
print('Score :', result.score)
print('Passed:', result.passed)

Try it Yourself

Example explained

  • Judge().run(output=…, expected=…) — Scores semantic agreement between your support policy reply and the expected golden answer.

Expect failure

Scores should fail when the answer drifts. Compare a wrong city on purpose.

Example

from praisonai.eval import Judge

result = Judge().run(
    output="The capital of France is London.",
    expected="Paris is the capital of France.",
)
print("Passed:", result.passed)

Try it Yourself

Example explained

  • from praisonai.eval import Judge — Imports Judge needed for expect failure.
  • Judge(…) — Scores an agent reply against explicit quality criteria.

Reference: documentation