id property, which is a unique identifier for the evaluator.
All of the code snippets can be run by following the instructions in the Quick Start guide.
Ragas
- LLM Context Precision With Reference
- Non LLM Context Precision With Reference
- LLM Context Recall
- Non LLM Context Recall
- Context Entities Recall
- Noise Sensitivity
- Response Relevancy
- Faithfulness
- Factual Correctness
- Semantic Similarity
Logic Based
Is Equals
TheIsEquals evaluator checks if the expected output equals the actual output.
Scores 1 if equal, 0 otherwise.
Is Valid JSON
TheIsValidJSON evaluator checks if the output is valid JSON.
Scores 1 if it is valid, 0 otherwise.
Has All Substrings
TheHasAllSubstrings evaluator checks if the output contains all the expected substrings.
Scores 1 if all substrings are present, 0 otherwise.
Assertions (Rubric/Rules)
TheAssertions evaluator enables you to define a set of assertions or rules that your output must satisfy.
Individual assertions can be marked as not required, and if they are not met, the evaluator will still pass.
LLM Judges
Custom LLM Judge
TheCustomLLMJudge evaluator enables you to define custom evaluation criteria using an LLM judge.
Accuracy
TheAccuracy evaluator checks if the output is accurate compared to an expected output.
Scores 1 if accurate, 0.5 if somewhat accurate, 0 if inaccurate.
NSFW
TheNSFW evaluator checks if the output is safe for work.
Scores 1 if safe, 0 otherwise.
Toxicity
TheToxicity evaluator checks if the output is not toxic.
Scores 1 if it is not toxic, 0 otherwise.
Ragas
Ragas is a framework that helps you evaluate your Retrieval Augmented Generation (RAG) pipelines. We have built wrappers around the metrics to make integration with Autoblocks seamless. Available Ragas evaluators:BaseRagasLLMContextPrecisionWithReferenceuses a LLM to measure the proportion of relevant chunks in the retrieved_contexts.BaseRagasNonLLMContextPrecisionWithReferencemeasures the proportion of relevant chunks in the retrieved_contexts without using a LLM.BaseRagasLLMContextRecallevaluates the extent to which the retrieved context aligns with the annotated answer, treated as the ground truth.BaseRagasNonLLMContextRecalluses non llm string comparison metrics to identify if a retrieved context is relevant or not.BaseRagasContextEntitiesRecallevaluates the measure of recall of the retrieved context, based on the number of entities present in both ground_truths and contexts relative to the number of entities present in the ground_truths alone.BaseRagasNoiseSensitivitymeasures how often a system makes errors by providing incorrect responses when utilizing either relevant or irrelevant retrieved documents.BaseRagasResponseRelevancyfocuses on assessing how pertinent the generated answer is to the given prompt.BaseRagasFaithfulnessmeasures the factual consistency of the generated answer against the given context.BaseRagasFactualCorrectnesscompares and evaluates the factual accuracy of the generated response with the reference. This metric is used to determine the extent to which the generated response aligns with the reference.BaseRagasSemanticSimilaritymeasures the semantic resemblance between the generated answer and the ground truth.
The Ragas evaluators are only available in the Python SDK. You must install Ragas (
pip install ragas) before using these evaluators.
Our wrappers require at least version 0.2.* of Ragas.Individual Ragas evaluators require different parameters.
You can find sample implementations for each of the Ragas evaluators here.

