Class FaithfulnessMetric

java.lang.Object
com.google.genkit.plugins.evaluators.metrics.FaithfulnessMetric

public class FaithfulnessMetric extends Object
Faithfulness metric evaluator.

Measures the factual consistency of the generated answer against the given context. Uses a two-step process: 1. Extract statements from the answer 2. Check each statement against the context using NLI

  • Constructor Details

  • Method Details

    • evaluate

      public EvalResponse evaluate(EvalDataPoint dataPoint) throws Exception
      Evaluates faithfulness of the output against the context.
      Parameters:
      dataPoint - the evaluation data point
      Returns:
      the evaluation response
      Throws:
      Exception - if evaluation fails