Skip to content

Evaluate

Prove the guarantee holds on your corpus. Python’s evaluate() runs each row of a golden CSV through ask() and returns an EvaluationReport. Go and JavaScript have no evaluate() — you drive Ask / ask over the rows and count, which produces the same numbers because it is the same flow.

All three tabs below run the same two-row golden.csv against the same two-doc corpus and print identical counts and rates.

from citenexus.evaluate import EvaluationReport
report: EvaluationReport = rag.evaluate("golden.csv")
print(report.total, report.answered, report.refused)
print(report.groundedness_rate, report.citation_rate, report.expected_support_rate)
# 2 1 1
# 1.0 1.0 0.5

The CSV needs a question column (query is also accepted) and an optional expected column:

question,expected
"Can the employee disclose confidential information?","shall not disclose"
"What is the capital of France?",
  • A row with an expected value counts as expected-supported when that text’s content tokens are a subset of the answer’s — a lightweight grounding check.
  • A row with an empty expected counts as expected-supported iff the row was answered (evaluate.py:76-77).