Skip to main content

A library for evaluating Retrieval-Augmented Generation (RAG) systems

Project description

RAG Evals

Overview

RAGEvals 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 ragevals

Usage

Here's how to use the RAGevals library:

from ragevals import RAGevals

# Initialize the evaluator
evaluator = RAGevals()

# 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)

# Get both metric and description
for metric,result in metrics.items():
  print(f"{metric}: {result['score']:.2f} \n{result['description']}")

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 RAGevals -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

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes.
  4. Run tests to ensure everything is working.
  5. Commit your changes and push to your fork.
  6. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ragevals-0.3.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ragevals-0.3.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file ragevals-0.3.0.tar.gz.

File metadata

  • Download URL: ragevals-0.3.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.1

File hashes

Hashes for ragevals-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d01d306fb63defd0983adc175b9132d6f5294c1974ae170a4ec28ac2bfaea15a
MD5 92a52c0b9e04e058f4ab7254f0f0122e
BLAKE2b-256 429c47073e8ffc3cbb7ef846b9c1521e3e496e5645f72ee448c3509eea04558e

See more details on using hashes here.

File details

Details for the file ragevals-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ragevals-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.1

File hashes

Hashes for ragevals-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2f108d6b53b6e3c9613210a301e60414c11e613908bb9da34c40f77ccbf8d2d
MD5 2267808b30e7a45d21e7159936f8ceb8
BLAKE2b-256 2ffb7f75b7e00e1c068850bbf370de7c2946006401b1f3e92793ffa433940ad7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page