{"id":22547258,"url":"https://github.com/shaadclt/ragas-synthetic-test-data-generation","last_synced_at":"2026-01-25T15:02:47.504Z","repository":{"id":253558883,"uuid":"843861885","full_name":"shaadclt/Ragas-Synthetic-Test-Data-Generation","owner":"shaadclt","description":"This project demonstrates how to generate synthetic test data for Retrieval Augmented Generation (RAG) using Ragas. ","archived":false,"fork":false,"pushed_at":"2024-08-17T16:56:08.000Z","size":104,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T01:11:36.866Z","etag":null,"topics":["ragas","synthetic-data-generation","test-data-generator"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/shaadclt.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-08-17T16:38:38.000Z","updated_at":"2024-10-24T06:05:55.000Z","dependencies_parsed_at":"2024-08-17T18:07:11.437Z","dependency_job_id":null,"html_url":"https://github.com/shaadclt/Ragas-Synthetic-Test-Data-Generation","commit_stats":null,"previous_names":["shaadclt/ragas-synthetic-test-data-generation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shaadclt/Ragas-Synthetic-Test-Data-Generation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaadclt%2FRagas-Synthetic-Test-Data-Generation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaadclt%2FRagas-Synthetic-Test-Data-Generation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaadclt%2FRagas-Synthetic-Test-Data-Generation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaadclt%2FRagas-Synthetic-Test-Data-Generation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaadclt","download_url":"https://codeload.github.com/shaadclt/Ragas-Synthetic-Test-Data-Generation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaadclt%2FRagas-Synthetic-Test-Data-Generation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28754807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T13:59:49.818Z","status":"ssl_error","status_checked_at":"2026-01-25T13:59:33.728Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ragas","synthetic-data-generation","test-data-generator"],"created_at":"2024-12-07T15:11:08.904Z","updated_at":"2026-01-25T15:02:47.475Z","avatar_url":"https://github.com/shaadclt.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Synthetic Test Data Generation using LangChain, Ragas, and Groq API\n\nThis project demonstrates how to generate synthetic test data for Retrieval Augmented Generation (RAG) using Ragas. \n\n## Table of Contents\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Environment Setup](#environment-setup)\n  - [Load Documents from PubMed](#load-documents-from-pubmed)\n  - [Generate Test Sets](#generate-test-sets)\n- [Output](#output)\n- [References](#references)\n- [License](#license)\n\n## Installation\n\nTo get started, clone the repository and install the required dependencies.\n\n```python\n!pip install ragas langchain_community langchain_groq sentence_transformers xmltodict -q\n```\n\n## Usage\n### Environment Setup\n1. Import necessary libraries and set up environment variables.\n2. Initialize the Groq API for data generation and critique models.\n3. Set up the HuggingFace BGE embeddings for document processing.\n\n### Load Documents from PubMed\nUse the `PubMedLoader` from `langchain_community` to load documents related to a specific query (e.g., \"cancer\"). In this project, we load a maximum of 5 documents.\n\n```python\nloader = PubMedLoader(\"cancer\", load_max_docs=5)\ndocuments = loader.load()\n```\n\n### Generate Test Sets\nWe use the TestsetGenerator from ragas to generate test sets based on the loaded documents. The test set generation includes:\n\n- Simple questions: 50%\n- Multi-context questions: 40%\n- Reasoning-based questions: 10%\n  \nThe following code sets up the test set generation:\n\n```python\ngenerator = TestsetGenerator.from_langchain(\n    data_generation_model,\n    critic_model,\n    embeddings\n)\ndistributions = {\n    simple: 0.5,\n    multi_context: 0.4,\n    reasoning: 0.1\n}\ntestset = generator.generate_with_langchain_docs(documents, 5, distributions)\ntest_df = testset.to_pandas()\n```\n\n### Output\nThe output is a Pandas DataFrame containing the generated test sets, which can be further analyzed or used for model evaluation.\n\n## License\nThis project is licensed under the [MIT License](/LICENSE.txt). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaadclt%2Fragas-synthetic-test-data-generation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaadclt%2Fragas-synthetic-test-data-generation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaadclt%2Fragas-synthetic-test-data-generation/lists"}