Skip to main content

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


Download files

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

Source Distribution

privatetestsetgenerationforllmeval-2.3.1.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file privatetestsetgenerationforllmeval-2.3.1.tar.gz.

File metadata

File hashes

Hashes for privatetestsetgenerationforllmeval-2.3.1.tar.gz
Algorithm Hash digest
SHA256 57e1a38b80609551ba2962510c3b43baa8f8e990744b752b03d2c04befc55797
MD5 ab7f5d243fda9991922f95b2697146ca
BLAKE2b-256 7cda662ea61bf07fed06ce8965d9f229149383b7ffc32cdd438a3c6b25d389b5

See more details on using hashes here.

File details

Details for the file privatetestsetgenerationforllmeval-2.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for privatetestsetgenerationforllmeval-2.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c84cc729525a09f34f5dd9aa6290a017e7298979438a5e76496a2e824378c96
MD5 bbf6ceed5067a1c800ed0edd64883b88
BLAKE2b-256 f5739b39e2c9d81299c141ad77d7a8781882ceaf0a91be24c792c496d1ba3d2d

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