HallucinationMetric
uses the evaluateHallucination
function to calculate this metric, focusing on distinguishing between faithful and hallucinated content.
evaluateHallucination
Functionoutput
: The text generated by the model.context
: The context used to assess the truthfulness of the output.HallucinationMetric
ClassHallucinationMetric
evaluates hallucinations in generated text based on the context from which the text should draw conclusions.
output
: The text generated by the model.context
: The reference context used for evaluation.evaluateSteps
method invokes evaluateHallucination
and provides a detailed result including a hallucination score. This score quantifies the proportion of the text that contains hallucinated information relative to the total content.