LLM Test Set Generation Framework
This framework automates the creation of synthetic question-answer datasets for LLM evaluation from PDF sources.
It extracts real-world domain text, ensures topic diversity, removes sensitive data (PII), and generates synthetic Q&A pairs.
Features
- PDF Ingestion: Extracts clean sentences from any PDF.
- Embeddings: Uses Azure OpenAI embeddings to represent sentences numerically.
- Topic Diversification: Clusters sentences into diverse topics using KMeans.
- Privacy Filtering: Detects and removes sensitive information (PII) with Presidio.
- Synthetic QA Generation: Generates rich, varied Q&A pairs via GPT-4 from sanitized text.
- Modular Pipeline: Built as a flexible multi-agent graph using LangGraph.
How It Works
Each step is an autonomous "agent" in a pipeline:
- Diversity Agent: Clusters data into meaningful topics.
- Privacy Agent: Analyzes clusters and flags sensitive content.
- Synthetic Data Generator: Creates QA samples while explaining coverage strategies.
Usage
To use the tool, follow these steps:
pip install privatetestsetgenerationforLLMeval
privatetestsetgeneration
Contributing
Contributions to improve the tool are welcome! Feel free to open issues for bugs or feature requests, or submit pull requests for enhancements.
Acknowledgements
This project utilizes various libraries, including LangChain for document processing and Presidio for PII detection and anonymization.
Clone the repository: Install dependencies: pip install -r requirements.txt Create a .env file with the following variables: AZURE_OPENAI_KEY=<your_azure_openai_api_key> AZURE_OPENAI_API_VERSION=2023-12-01-preview AZURE_ENDPOINT=https://<your_azure_resource>.openai.azure.com/ EMBEDDING_DEPLOYMENT_NAME=text-embedding-ada-002 GPT_4_MODEL_DEPLOYMENT_NAME=gpt-4
Run the main pipeline:
to complete
To provide a path to a PDF. To select the number of synthetic Q&A pairs to generate. The pipeline will:
Process your document. Create a topic-augmented, privacy-safe synthetic dataset. Save a .csv file (e.g., qa_pairs10.csv) containing the generated Q&A pairs.
📄 Example Output
Question Answer What are the primary goals of digital transformation? To leverage technology to optimize business processes, enhance customer experiences, and create new revenue streams. How can data privacy be ensured when migrating to the cloud? Through encryption, compliance audits, access control, and anonymization of sensitive data.
Metadata
Release files for privatetestsetgenerationforLLMeval 2.3.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 | |
|---|---|---|---|
| privatetestsetgenerationforllmeval-2.3.1.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| privatetestsetgenerationforllmeval-2.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.2 kB
Release files / privatetestsetgenerationforllmeval-2.3.1.tar.gz
| Download URL | privatetestsetgenerationforllmeval-2.3.1.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57e1a38b80609551ba2962510c3b43baa8f8e990744b752b03d2c04befc55797
|
|
BLAKE2b-256 checksum How to use checksums |
7cda662ea61bf07fed06ce8965d9f229149383b7ffc32cdd438a3c6b25d389b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / privatetestsetgenerationforllmeval-2.3.1-py3-none-any.whl
| Download URL | privatetestsetgenerationforllmeval-2.3.1-py3-none-any.whl |
|---|---|
| Size | 23.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c84cc729525a09f34f5dd9aa6290a017e7298979438a5e76496a2e824378c96
|
|
BLAKE2b-256 checksum How to use checksums |
f5739b39e2c9d81299c141ad77d7a8781882ceaf0a91be24c792c496d1ba3d2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|