A comprehensive evaluation toolkit for assessing Retrieval-Augmented Generation (RAG) outputs using linguistic, semantic, and fairness metrics
4
stars
5
commits
Python
primary language
Apr 19, 2025
updated
EvalRAG is a comprehensive evaluation toolkit for assessing Retrieval-Augmented Generation (RAG) outputs using linguistic, semantic, and fairness metrics.
You can install the library using pip:
pip install eval-rag
Here's how to use the Eval RAG library:
from eval_rag import EvalRAG
# Initialize the evaluator
evaluator = EvalRAG()
# Input data
question = "What are the causes of climate change?"
response = "Climate change is caused by human activities."
reference = "Human activities such as burning fossil fuels cause climate change."
# Evaluate the response
metrics = evaluator.evaluate_all(question, response, reference)
# Print the results
print(metrics)
The RAG Evaluator provides the following metrics:
BLEU (0-100): Measures the overlap between the generated output and reference text based on n-grams.
ROUGE-1 (0-1): Measures the overlap of unigrams between the generated output and reference text.
BERT Score (0-1): Evaluates the semantic similarity using BERT embeddings (Precision, Recall, F1).
Perplexity (1 to ∞, lower is better): Measures how well a language model predicts the text.
Diversity (0-1): Measures the uniqueness of bigrams in the generated output.
Racial Bias (0-1): Detects the presence of biased language in the generated output.
MAUVE (0-1): MAUVE captures contextual meaning, coherence, and fluency while measuring both semantic similarity and stylistic alignment .
METEOR (0-1): Calculates semantic similarity considering synonyms and paraphrases.
CHRF (0-1): Computes Character n-gram F-score for fine-grained text similarity.
Flesch Reading Ease (0-100): Assesses text readability.
To run the tests, use the following command:
python -m unittest discover -s eval_rag -p "test_*.py"
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! If you have any improvements, suggestions, or bug fixes, feel free to create a pull request (PR) or open an issue on GitHub. Please ensure your contributions adhere to the project's coding standards and include appropriate tests.
If you have any questions or need further assistance, feel free to reach out via email.
5 commits
Python
100.0%
A comprehensive evaluation toolkit for assessing Retrieval-Augmented Generation (RAG) outputs using linguistic, semantic, and fairness metrics
4
stars
5
commits
Python
primary language
Apr 19, 2025
updated
EvalRAG is a comprehensive evaluation toolkit for assessing Retrieval-Augmented Generation (RAG) outputs using linguistic, semantic, and fairness metrics.
You can install the library using pip:
pip install eval-rag
Here's how to use the Eval RAG library:
from eval_rag import EvalRAG
# Initialize the evaluator
evaluator = EvalRAG()
# Input data
question = "What are the causes of climate change?"
response = "Climate change is caused by human activities."
reference = "Human activities such as burning fossil fuels cause climate change."
# Evaluate the response
metrics = evaluator.evaluate_all(question, response, reference)
# Print the results
print(metrics)
The RAG Evaluator provides the following metrics:
BLEU (0-100): Measures the overlap between the generated output and reference text based on n-grams.
ROUGE-1 (0-1): Measures the overlap of unigrams between the generated output and reference text.
BERT Score (0-1): Evaluates the semantic similarity using BERT embeddings (Precision, Recall, F1).
Perplexity (1 to ∞, lower is better): Measures how well a language model predicts the text.
Diversity (0-1): Measures the uniqueness of bigrams in the generated output.
Racial Bias (0-1): Detects the presence of biased language in the generated output.
MAUVE (0-1): MAUVE captures contextual meaning, coherence, and fluency while measuring both semantic similarity and stylistic alignment .
METEOR (0-1): Calculates semantic similarity considering synonyms and paraphrases.
CHRF (0-1): Computes Character n-gram F-score for fine-grained text similarity.
Flesch Reading Ease (0-100): Assesses text readability.
To run the tests, use the following command:
python -m unittest discover -s eval_rag -p "test_*.py"
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! If you have any improvements, suggestions, or bug fixes, feel free to create a pull request (PR) or open an issue on GitHub. Please ensure your contributions adhere to the project's coding standards and include appropriate tests.
If you have any questions or need further assistance, feel free to reach out via email.
5 commits
Python
100.0%