Skip to main content

synthetic-data-gen

Generate synthetic training data for ML pipelines — Q&A pairs, classification examples, tabular data, and instruction-following datasets.

Tests Python License LinkedIn

Install

pip install synthetic-data-gen

Requires ANTHROPIC_API_KEY environment variable.

Quick start

from synth_data import SynthDataGen

gen = SynthDataGen()

# Q&A pairs from your corpus
qa = gen.qa_pairs(context="The UK AI Safety Institute was founded in 2023...", n=10)
qa.save("qa_train.jsonl")

# Classification examples
examples = gen.classification(
    labels=["compliant", "non_compliant", "requires_review"],
    domain="UK GDPR data processing records",
    n=60,
)
examples.save("gdpr_train.csv", format="csv")

# Instruction-following dataset
dataset = gen.instructions(
    task_description="Summarise UK government policy documents",
    n=30,
)
print(dataset.to_alpaca())  # Alpaca fine-tuning format

# Tabular synthetic data
employees = gen.tabular(
    columns=["name", "department", "grade", "salary"],
    schema={"grade": "one of: EO, HEO, SEO, G7, G6", "salary": "integer 25000-120000"},
    domain="UK civil service",
    n=100,
)
employees.save("workforce.csv", format="csv")

Export formats

dataset.to_json()    # pretty-printed JSON
dataset.to_jsonl()   # one object per line (HuggingFace format)
dataset.to_csv()     # CSV with headers
dataset.to_alpaca()  # Alpaca instruction-tuning format
dataset.save("file.jsonl", format="jsonl")

Linda Oraegbunam | LinkedIn | GitHub

Release files for synthetic-dataset-gen 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for synthetic-dataset-gen 1.0.0
File Size Uploaded
synthetic_dataset_gen-1.0.0.tar.gz 10.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for synthetic-dataset-gen 1.0.0
File Interpreter ABI Platform
synthetic_dataset_gen-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.8 kB

Release files / synthetic_dataset_gen-1.0.0.tar.gz

Download URL synthetic_dataset_gen-1.0.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
22e330d76215925a98c523de8b07aca5bbb53603d192089d271ff9bc3f7289ab
BLAKE2b-256 checksum
How to use checksums
ec9153a5cb576d07de1eee901f7a0c01ce9f84fc7748b04984be65871581ed45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.

Transparency log

Release files / synthetic_dataset_gen-1.0.0-py3-none-any.whl

Download URL synthetic_dataset_gen-1.0.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df43decaa682d22b64aec15cb941b291760abec2af6af973fa1d1649451fb5d8
BLAKE2b-256 checksum
How to use checksums
e7098f7076bd435bf6ffee4f9c3ae9e8174fa91807a12d37ebfb608b3882287b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page