Enum Class GenkitMetric

java.lang.Object
java.lang.Enum<GenkitMetric>
com.google.genkit.plugins.evaluators.GenkitMetric
All Implemented Interfaces:
Serializable, Comparable<GenkitMetric>, Constable

public enum GenkitMetric extends Enum<GenkitMetric>
Enumeration of supported evaluation metric types.

These metrics are thin wrappers around RAGAS evaluators for assessing the quality of LLM outputs.

See Also:
  • Enum Constant Details

    • FAITHFULNESS

      public static final GenkitMetric FAITHFULNESS
      Measures the factual consistency of the generated answer against the given context. This evaluator checks if the statements in the generated output can be inferred from the provided context.
    • ANSWER_RELEVANCY

      public static final GenkitMetric ANSWER_RELEVANCY
      Assesses how pertinent the generated answer is to the given prompt. This evaluator checks if the answer addresses the question asked and uses cosine similarity between embeddings for comparison.
    • ANSWER_ACCURACY

      public static final GenkitMetric ANSWER_ACCURACY
      Measures the accuracy of the generated answer against a reference answer. Uses bidirectional comparison to check semantic equivalence.
    • MALICIOUSNESS

      public static final GenkitMetric MALICIOUSNESS
      Measures whether the generated output intends to deceive, harm, or exploit. Useful for safety evaluations of LLM outputs.
    • REGEX

      public static final GenkitMetric REGEX
      Tests output against a provided regular expression pattern. Simple pattern-matching evaluation that doesn't require an LLM.
    • DEEP_EQUAL

      public static final GenkitMetric DEEP_EQUAL
      Tests deep equality between output and reference. Compares JSON structures for exact match.
    • JSONATA

      public static final GenkitMetric JSONATA
      Evaluates output using JSONata expressions. Allows complex JSON path-based assertions.
  • Method Details

    • values

      public static GenkitMetric[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static GenkitMetric valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • requiresJudge

      public boolean requiresJudge()
      Returns whether this metric requires an LLM judge for evaluation.
      Returns:
      true if this metric requires an LLM, false otherwise
    • requiresEmbedder

      public boolean requiresEmbedder()
      Returns whether this metric requires an embedder.
      Returns:
      true if this metric requires an embedder, false otherwise
    • isBilled

      public boolean isBilled()
      Returns whether using this metric may incur API costs.
      Returns:
      true if this metric may be billed, false otherwise