Class AnswerRelevancyMetric

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

public class AnswerRelevancyMetric extends Object
Answer Relevancy metric evaluator.

Assesses how pertinent the generated answer is to the given prompt. Uses an LLM judge to analyze the answer and optionally uses embeddings for similarity comparison.

  • Constructor Details

  • Method Details

    • evaluate

      public EvalResponse evaluate(EvalDataPoint dataPoint) throws Exception
      Evaluates the relevancy of the answer to the question.
      Parameters:
      dataPoint - the evaluation data point
      Returns:
      the evaluation response
      Throws:
      Exception - if evaluation fails