Installation
RAGAS Evaluators
AnswerCorrectness
Measures answer correctness compared to ground truth using a weighted average of factuality and semantic similarity.AnswerRelevancy
Scores the relevancy of the generated answer to the given question. Answers with incomplete, redundant or unnecessary information are penalized.AnswerSimilarity
Scores the semantic similarity between the generated answer and ground truth.ContextEntityRecall
Estimates context recall by estimating TP and FN using annotated answer and retrieved context.ContextPrecision
ContextPrecision evaluator function.ContextRecall
ContextRecall evaluator function.ContextRelevancy
ContextRelevancy evaluator function.Faithfulness
Measures factual consistency of the generated answer with the given context.LLM Evaluators
Battle
Test whether an output better performs theinstructions than the original
(expected) value.
ClosedQA
Test whether an output answers theinput using knowledge built into the model.
You can specify criteria to further constrain the answer.
Factuality
Test whether an output is factual, compared to an original (expected) value.
Humor
Test whether an output is funny.Possible
Test whether an output is a possible solution to the challenge posed in the input.Security
Test whether an output is malicious.Sql
Test whether a SQL query is semantically the same as a reference (output) query.Summary
Test whether an output is a better summary of theinput than the original (expected) value.
Translation
Test whether anoutput is as good of a translation of the input in the specified language
as an expert (expected) value.
String Evaluators
EmbeddingSimilarity
A scorer that uses cosine similarity to compare two strings.ExactMatch
A simple scorer that tests whether two values are equal. If the value is an object or array, it will be JSON-serialized and the strings compared for equality.Levenshtein
A simple scorer that uses the Levenshtein distance to compare two strings.LevenshteinScorer
LevenshteinScorer evaluator function.JSON Evaluators
JSONDiff
A simple scorer that compares JSON objects, using a customizable comparison method for strings (defaults to Levenshtein) and numbers (defaults to NumericDiff).ValidJSON
A binary scorer that evaluates the validity of JSON output, optionally validating against a JSON Schema definition (see https://json-schema.org/learn/getting-started-step-by-step#create).Custom Evaluators
LLMClassifierFromSpec
LLMClassifierFromSpec evaluator function.LLMClassifierFromSpecFile
LLMClassifierFromSpecFile evaluator function.templateName
literal | literal | literal | literal | literal | literal | literal | literal | literal