{"id":18749706,"url":"https://github.com/aianytime/rag-evaluator","last_synced_at":"2025-04-30T09:51:03.009Z","repository":{"id":240950568,"uuid":"803919267","full_name":"AIAnytime/rag-evaluator","owner":"AIAnytime","description":"A library for evaluating Retrieval-Augmented Generation (RAG) systems (The traditional ways).","archived":false,"fork":false,"pushed_at":"2024-08-10T10:26:30.000Z","size":53,"stargazers_count":26,"open_issues_count":0,"forks_count":15,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-18T20:09:36.299Z","etag":null,"topics":["eval","evals","rag"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AIAnytime.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-21T15:56:18.000Z","updated_at":"2024-12-08T22:32:27.000Z","dependencies_parsed_at":"2024-08-10T11:53:48.313Z","dependency_job_id":null,"html_url":"https://github.com/AIAnytime/rag-evaluator","commit_stats":null,"previous_names":["aianytime/rag-evaluator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIAnytime%2Frag-evaluator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIAnytime%2Frag-evaluator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIAnytime%2Frag-evaluator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AIAnytime%2Frag-evaluator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AIAnytime","download_url":"https://codeload.github.com/AIAnytime/rag-evaluator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231370914,"owners_count":18366433,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eval","evals","rag"],"created_at":"2024-11-07T17:08:28.909Z","updated_at":"2024-12-26T15:09:46.171Z","avatar_url":"https://github.com/AIAnytime.png","language":"Python","readme":"# RAG Evaluator\n\n## Overview\n\nRAG 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.\n\n## Installation\n\nYou can install the library using pip:\n\n```bash\npip install rag-evaluator\n```\n\n## Usage\n\nHere's how to use the RAG Evaluator library:\n\n```python\nfrom rag_evaluator import RAGEvaluator\n\n# Initialize the evaluator\nevaluator = RAGEvaluator()\n\n# Input data\nquestion = \"What are the causes of climate change?\"\nresponse = \"Climate change is caused by human activities.\"\nreference = \"Human activities such as burning fossil fuels cause climate change.\"\n\n# Evaluate the response\nmetrics = evaluator.evaluate_all(question, response, reference)\n\n# Print the results\nprint(metrics)\n```\n\n## Streamlit Web App\n\nTo run the web app:\n\n1. cd into streamlit app folder.\n2. Create a virtual env\n3. Activate the virtual env\n4. Install all dependencies\n5. Run the app:\n```\nstreamlit run app.py\n```\n\n## Metrics\n\nThe RAG Evaluator provides the following metrics:\n\n1. **BLEU** (0-100): Measures the overlap between the generated output and reference text based on n-grams.\n   - 0-20: Low similarity, 20-40: Medium-low, 40-60: Medium, 60-80: High, 80-100: Very high\n\n2. **ROUGE-1** (0-1): Measures the overlap of unigrams between the generated output and reference text.\n   - 0.0-0.2: Poor overlap, 0.2-0.4: Fair, 0.4-0.6: Good, 0.6-0.8: Very good, 0.8-1.0: Excellent\n\n3. **BERT Score** (0-1): Evaluates the semantic similarity using BERT embeddings (Precision, Recall, F1).\n   - 0.0-0.5: Low similarity, 0.5-0.7: Moderate, 0.7-0.8: Good, 0.8-0.9: High, 0.9-1.0: Very high\n\n4. **Perplexity** (1 to ∞, lower is better): Measures how well a language model predicts the text.\n   - 1-10: Excellent, 10-50: Good, 50-100: Moderate, 100+: High (potentially nonsensical)\n\n5. **Diversity** (0-1): Measures the uniqueness of bigrams in the generated output.\n   - 0.0-0.2: Very low, 0.2-0.4: Low, 0.4-0.6: Moderate, 0.6-0.8: High, 0.8-1.0: Very high\n\n6. **Racial Bias** (0-1): Detects the presence of biased language in the generated output.\n   - 0.0-0.2: Low probability, 0.2-0.4: Moderate, 0.4-0.6: High, 0.6-0.8: Very high, 0.8-1.0: Extreme\n\n7. **MAUVE** (0-1): MAUVE captures contextual meaning, coherence, and fluency while measuring both semantic similarity and stylistic alignment .\n   -  0.0-0.2 (Poor), 0.2-0.4 (Fair), 0.4-0.6 (Good), 0.6-0.8 (Very good), 0.8-1.0 (Excellent).\n     \n8. **METEOR** (0-1): Calculates semantic similarity considering synonyms and paraphrases.\n   - 0.0-0.2: Poor, 0.2-0.4: Fair, 0.4-0.6: Good, 0.6-0.8: Very good, 0.8-1.0: Excellent\n\n9. **CHRF** (0-1): Computes Character n-gram F-score for fine-grained text similarity.\n   - 0.0-0.2: Low, 0.2-0.4: Moderate, 0.4-0.6: Good, 0.6-0.8: High, 0.8-1.0: Very high\n\n10. **Flesch Reading Ease** (0-100): Assesses text readability.\n   - 0-30: Very difficult, 30-50: Difficult, 50-60: Fairly difficult, 60-70: Standard, 70-80: Fairly easy, 80-90: Easy, 90-100: Very easy\n\n11. **Flesch-Kincaid Grade** (0-18+): Indicates the U.S. school grade level needed to understand the text.\n    - 1-6: Elementary, 7-8: Middle school, 9-12: High school, 13+: College level\n\n## Testing\n\nTo run the tests, use the following command:\n\n```\npython -m unittest discover -s rag_evaluator -p \"test_*.py\"\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions 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.\n\n### How to Contribute\n\n1. Fork the repository.\n2. Create a new branch for your feature or bug fix.\n3. Make your changes.\n4. Run tests to ensure everything is working.\n5. Commit your changes and push to your fork.\n6. Create a pull request (PR) with a detailed description of your changes.\n\n## Contact\n\nIf you have any questions or need further assistance, feel free to reach out via [email](mailto:aianytime07@gmail.com).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faianytime%2Frag-evaluator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faianytime%2Frag-evaluator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faianytime%2Frag-evaluator/lists"}