ReadonlynameUnique camelCase name identifying this metric.
Used as keys in score results — must be unique within a single evaluate() call.
Any string is valid; built-in metrics use faithfulness, contextRelevance, etc.
ReadonlydescriptionHuman-readable description of what this metric measures.
Compute the metric score for one RAG sample.
The sample's question, answer, contexts, and optional groundTruth.
The LLM provider used as the judge for this evaluation.
OptionalincludeReasoning: booleanWhen true, include the LLM's reasoning in the output.
Promise resolving to a MetricOutput with score and optional reasoning.
May return skipped: true when the metric cannot be computed (e.g. no groundTruth).
A Metric is a named evaluation function that scores a single RAG sample.
All five built-in metrics implement this interface. You can also implement it yourself to create custom domain-specific metrics -- any string name is accepted, not just the five built-in names:
Example