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

Try it Yourself

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.

Reference: documentation