Skip to main content

Generate synthetic evaluation datasets from your own documents.

Project description

Data Simulator

Open In Colab

data-simulator is a lightweight Python library for generating synthetic datasets from your own corpus — perfect for testing, evaluating, or fine-tuning LLM Applications.

Motivation

Real documents contain a mix of useful and irrelevant content. When generating synthetic data, this leads to:

  • Queries that real users would never ask
  • Test sets that don't reflect actual usage
  • Wasted effort optimizing for the wrong things

Data Simulator filters out low-quality content first, then generates realistic queries and answers that match how your system will actually be used.


Getting Started

Install from PyPI:

pip install llm-data-simulator

Or install it locally:

git clone https://github.com/langwatch/data-simulator.git
cd data-simulator
pip install -e .

Run the built-in test script:

python test.py

Example test.py

from data_simulator import DataSimulator
from dotenv import load_dotenv
import os
from data_simulator.utils import display_results

load_dotenv()

generator = DataSimulator(api_key=os.getenv("OPENAI_API_KEY"))

results = generator.generate_from_docs(
    file_paths=["test_data/nike_10k.pdf"],
    context="You're a financial support assistant for Nike, helping a financial analyst decide whether to invest in the stock.",
    example_queries="how much revenue did nike make last year\nwhat risks does nike face\nwhat are nike's top 3 priorities"
)

display_results(results)

Output Format

{
  "id": "chunk_42",
  "document": "Nike reported annual revenue of $44.5 billion for fiscal year 2022, an increase of 5% compared to the previous year.",
  "query": "What was Nike's revenue growth in 2022?",
  "answer": "Nike's revenue grew by 5% in fiscal year 2022, reaching $44.5 billion."
}

Project Structure

The project follows a modular, object-oriented design:

  • simulator.py: Contains the main DataSimulator class that orchestrates the data generation process
  • llm.py: Houses the LLMProcessor class that handles all LLM-related operations
  • document_processor.py: Provides the DocumentProcessor class for loading and chunking documents
  • prompts.py: Stores all prompt templates used for LLM interactions
  • utils.py: Contains utility functions like display_results for formatting output

License

MIT License

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

llm_data_simulator-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

llm_data_simulator-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file llm_data_simulator-0.1.0.tar.gz.

File metadata

  • Download URL: llm_data_simulator-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for llm_data_simulator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ebb5f0ec410195202521f535f1d3a59f7c0735131977fd0aa27f5684816dd336
MD5 e6239a056b775a61db7747f6c97841c7
BLAKE2b-256 28bf2340780ce43bb1584f1fd7fa3a8726c69424d254df7eaa03a0e15f83a712

See more details on using hashes here.

File details

Details for the file llm_data_simulator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_data_simulator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f45aa81a2c7cbe0a7bbe3235079845fe6fecfaa411ee365cd6e300a4b45dc22
MD5 7aa17f79380ea22258cfafad12dacde5
BLAKE2b-256 ce2355355c865ffc1a1df3c416d7ed9bcbb3a0fd1fde122d9ef91e1fa14c7995

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