Skip to main content
Several providers offer a batch API. You upload many prompts at once, the provider processes them within a time window, and the price is usually about half the normal price. Batch APIs take work to use directly.
  • You have to write a batch file, upload it, and check for results until they are ready.
  • Each provider limits the size of a batch, so you have to split a large dataset into several batches and track each one.
Curator does all of this for you. You set batch=True when you create an LLM object.

Supported providers

The litellm backend does not support batch mode. The mistral and azure backends support only batch mode.

Example

This example writes new responses for the first messages in the WildChat dataset. The class is the same for every provider.
Next, set up your provider and create the object with batch=True.
Set your API key.
To use another API that is compatible with the OpenAI batch API, set backend="openai" and pass base_url and api_key in backend_params.
Then run it.
The output looks like this.

Batch settings

Pass these keys in backend_params when batch=True.
The API reference lists the settings that apply to every backend, e.g., max_retries.

Cancel running batches

To cancel the batches of a run, call the object again with the same input and batch_cancel=True. Curator asks you to confirm before it cancels them.