# Curator

> Build synthetic data pipelines for training and post-training language models

- Category: Data & Labeling / Synthetic Data
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/bespokelabsai/curator
- Website: https://docs.bespokelabs.ai
- Canonical page: https://ai-tldr.dev/tools/curator/

## In short

Curator is Build synthetic data pipelines for training and post-training language models. You describe how to prompt a model and how to parse its reply, then run that over a dataset to produce clean, structured training data. It sits in the Synthetic Data category of the Data & Labeling tools and is open-source, written in Python and licensed Apache-2.0.

## Overview

Bespoke Curator is a Python library for building synthetic data pipelines. You describe how to prompt a model and how to parse its reply, then run that over a dataset to produce clean, structured training data. It works whether you are generating fresh examples or extracting structured fields from existing text.

It is aimed at people who train or post-train language models and need data at scale: building reasoning datasets, distillation sets, or fine-tuning corpora. The library handles the repetitive parts of large generation jobs, including asynchronous requests, caching, and fault recovery, so a run can stop and resume without redoing finished work.

In the synthetic data and labeling space, Curator sits between your prompts and many inference backends. It supports a range of providers through LiteLLM, vLLM, and batch APIs from OpenAI, Anthropic, Gemini, and others, and ships a viewer to watch data as it is generated.

## What it does

- Define generation as a curator.LLM subclass with prompt() and parse() methods over a dataset
- First-class structured outputs using Pydantic response models
- Built-in caching, async requests, and fault recovery for large-scale runs
- Wide backend support via LiteLLM, vLLM, and batch APIs (OpenAI, Anthropic, Gemini)
- Batch mode to cut token costs on supported providers
- Viewer to monitor data while it is being generated, plus code execution and fine-tuning integrations (Tinker, Fireworks AI)

## Getting started

Install the package, then define an LLM class that says how to prompt the model and how to parse each response into rows of data.

1. Install Curator

   Install the library from PyPI. You will also need the datasets and pydantic packages used in the example.

```bash
pip install bespokelabs-curator
```

2. Define and run a curator.LLM

   Subclass curator.LLM, implement prompt() and parse(), use a Pydantic model for structured output, then call the analyzer on your dataset. Set the API key for your chosen model provider (here OpenAI) in your environment first.

```python
from typing import Dict, Literal
from bespokelabs import curator
from pydantic import BaseModel, Field

class Sentiment(BaseModel):
  sentiment: Literal["positive", "negative", "neutral"] = Field(
    description="Sentiment of the review")

class SentimentAnalyzer(curator.LLM):

  def prompt(self, product: Dict):
    return f"Determine the sentiment of the product from the review: {product['review']}"

  def parse(self, product: Dict, response: Sentiment):
    return [{"name": product["name"], "sentiment": response.sentiment}]

dataset = [{"name": "Curator", "review": "Already saved hours in one day of use."},
           {"name": "Bespoke MiniCheck", "review": "Hallucination rates dropped by 90%."}]

analyzer = SentimentAnalyzer(
    model_name="gpt-4o-mini", response_format=Sentiment, batch=False)
reviews = analyzer(dataset)
print(reviews.to_pandas())
```

3. Read the docs

   See the full documentation for tutorials, how-to guides, and the LLM API reference at docs.bespokelabs.ai.

## When to use it

- Generate reasoning or instruction datasets to post-train or distill a smaller model
- Extract structured fields (sentiment, features, labels) from unstructured text at scale
- Run large batch generation jobs cheaply using provider batch APIs with caching and resume
- Curate data and feed it into a fine-tuning step, such as a LoRA via Tinker or Fireworks AI
