Skip to main content

Create synthetic datasets with LLM generators and samplers

Project description

Chatan

Create diverse, synthetic datasets. Start from scratch or augment an existing dataset. Simple define your dataset schema as a set of generators, typically being LLMs with a prompt describing what kind of examples you want.

Installation

pip install chatan

Getting Started

import chatan

# Create a generator
gen = chatan.generator("openai", "YOUR_API_KEY")

# Define a dataset schema
ds = chatan.dataset({
    "topic": chatan.sample.choice(["Python", "JavaScript", "Rust"]),
    "prompt": gen("write a programming question about {topic}"),
    "response": gen("answer this question: {prompt}")
})

# Generate the data with a progress bar
df = ds.generate(n=10)

Examples

Create Data Mixes

from chatan import dataset, generator, sample
import uuid

gen = generator("openai", "YOUR_API_KEY")

mix = [
    "san antonio, tx",
    "marfa, tx",
    "paris, fr"
]

ds = dataset({
    "id": sample.uuid(),
    "topic": sample.choice(mix),
    "prompt": gen("write an example question about the history of {topic}"),
    "response": gen("respond to: {prompt}"),
})

Augment datasets

from chatan import generator, dataset, sample
from datasets import load_dataset

gen = generator("openai", "YOUR_API_KEY")
hf_data = load_dataset("some/dataset")

ds = dataset({
    "original_prompt": sample.from_dataset(hf_data, "prompt"),
    "variation": gen("rewrite this prompt: {original_prompt}"),
    "response": gen("respond to: {variation}")
})

Citation

If you use this code in your research, please cite:

@software{reetz2025chatan,
  author = {Reetz, Christian},
  title = {chatan: Create synthetic datasets with LLM generators.},
  url = {https://github.com/cdreetz/chatan},
  year = {2025}
}

Contributing

Community contributions are more than welcome, bug reports, bug fixes, feature requests, feature additions, please refer to the Issues tab.

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

chatan-0.1.3.tar.gz (334.1 kB view details)

Uploaded Source

Built Distribution

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

chatan-0.1.3-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file chatan-0.1.3.tar.gz.

File metadata

  • Download URL: chatan-0.1.3.tar.gz
  • Upload date:
  • Size: 334.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.8

File hashes

Hashes for chatan-0.1.3.tar.gz
Algorithm Hash digest
SHA256 01ef352c9f6575c06ab9303f9aee330765bd40bfdf6588f327cf7c4ec7a90035
MD5 b0e8abb7654de79f3f15465f2d8257c8
BLAKE2b-256 536acefd7786f8aa6ce3c6d880b6ee5500cdf2f749090c2f5a7102954429b645

See more details on using hashes here.

File details

Details for the file chatan-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: chatan-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.8

File hashes

Hashes for chatan-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2a79750bfa8bc08fa954ccc9342a23026d07b3e60dfecc8485b7aafee5132b90
MD5 a9d7e7ab23e27597c79496bd7cb03d92
BLAKE2b-256 4240e13bd52b90a474821c9cdc0d5ff075744741ac28b4556bffd13b8ceedc69

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