A library for evaluating Retrieval-Augmented Generation (RAG) systems
Project description
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 evalRagPk
Usage
Here's how to use the RAG Evaluator library:
from evalRagPk import evaluate_all
# 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 = 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 evalRagPk -p "test_*.py"
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
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.
How to Contribute
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes.
- Run tests to ensure everything is working.
- Commit your changes and push to your fork.
- Create a pull request (PR) with a detailed description of your changes.
Contact
If you have any questions or need further assistance, feel free to reach out via email.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for evalRagPk-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31cb763f363bcdb76592bcd45353892443c624ea123bc28599196357ca85cbf7 |
|
MD5 | 4a887b84b466f3055555038df5be455a |
|
BLAKE2b-256 | a1a64bc799ce2bb01fb5e7435e9857ea3380845372fc19576f22e82a32d13f55 |