A package for generating evaluation set for LLM-based chatbots in a diverse and private manner
Project description
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.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file privatetestsetgenerationforllmeval-2.3.1.tar.gz.
File metadata
- Download URL: privatetestsetgenerationforllmeval-2.3.1.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57e1a38b80609551ba2962510c3b43baa8f8e990744b752b03d2c04befc55797
|
|
| MD5 |
ab7f5d243fda9991922f95b2697146ca
|
|
| BLAKE2b-256 |
7cda662ea61bf07fed06ce8965d9f229149383b7ffc32cdd438a3c6b25d389b5
|
File details
Details for the file privatetestsetgenerationforllmeval-2.3.1-py3-none-any.whl.
File metadata
- Download URL: privatetestsetgenerationforllmeval-2.3.1-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c84cc729525a09f34f5dd9aa6290a017e7298979438a5e76496a2e824378c96
|
|
| MD5 |
bbf6ceed5067a1c800ed0edd64883b88
|
|
| BLAKE2b-256 |
f5739b39e2c9d81299c141ad77d7a8781882ceaf0a91be24c792c496d1ba3d2d
|