RAG Evaluator
Overview
RAG Evaluator is a Python library for evaluating Retrieval-Augmented Generation (RAG) systems. It provides various metrics to evaluate the quality of generated text against reference text.
Installation
You can install the library using pip:
pip install evaluatorspk
Usage
Here's how to use the RAG Evaluator library:
from evaluatorspk import RAGEvaluator
# Initialize the evaluator
evaluator = RAGEvaluator()
# 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)
Streamlit Web App
To run the web app:
- cd into streamlit app folder.
- Create a virtual env
- Activate
- Install all dependencies
- and run
streamlit run app.py
Metrics
The following metrics are provided by the library:
- BLEU: Measures the overlap between the generated output and reference text based on n-grams.
- ROUGE-1: Measures the overlap of unigrams between the generated output and reference text.
- BERT Score: Evaluates the semantic similarity between the generated output and reference text using BERT embeddings.
- Perplexity: Measures how well a language model predicts the text.
- Diversity: Measures the uniqueness of bigrams in the generated output.
- Racial Bias: Detects the presence of biased language in the generated output.
Testing
To run the tests, use the following command:
python -m unittest discover -s rag_evaluator -p "test_*.py"
Metadata
Release files for evaluatorspk 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| evaluatorspk-0.0.1.tar.gz | 4.4 kB | Without provenance | Details for evaluatorspk-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| evaluatorspk-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for evaluatorspk-0.0.1-py3-none-any.whl |
Total release size: 9.5 kB
Release files / evaluatorspk-0.0.1.tar.gz
| Download URL | evaluatorspk-0.0.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8c149543751e0736f3f714833221a3ea1aa7aeb26f0dc6f9674930021c78c9f
|
|
BLAKE2b-256 checksum How to use checksums |
ce7134d8f027076b1eaad613f1ac2656d445e9fc9d7a38a18b3ae1665350a1de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Release files / evaluatorspk-0.0.1-py3-none-any.whl
| Download URL | evaluatorspk-0.0.1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
961b967582e168b2ebb64491f0e7076efc8087994ace78a212852b97ff45cb0c
|
|
BLAKE2b-256 checksum How to use checksums |
c8c32a939696dc15ef4bdae3eb3f0431a4b75bbe751603c01fe971234ec87af2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Security for evaluatorspk 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.