Invent a dataset
Generate a model-ready dataset from scratch, with no source dataset required.
Invent generates a model-ready dataset from scratch—no source dataset required. Describe your dataset with a prompt, optionally narrow with domains and subdomains, and the API creates a dataset for your task.
Use datasets.create instead when you want to import and adapt an existing dataset.
What you can build
Section titled “What you can build”- Instruction datasets pair prompts with generated completions for supervised fine-tuning.
- Preference pairs rank two completions against each other for preference-based training.
How it works
Section titled “How it works”- Describe your dataset. Use the
dataset_promptand optionaldomainsandsubdomainsto guide the dataset invention process. - Estimate (optional). Price the exact request with
estimate=True. Nothing is created or charged. - Generate. Call
datasets.inventto create the dataset and start generation. The call returns immediately with statusrunning. - Poll and download. Poll
datasets.getuntil the status issucceeded, then download the rows or export them to Hugging Face, Kaggle, or Google Sheets.
Generate a dataset
Section titled “Generate a dataset”A single call to datasets.invent creates the dataset and starts generating rows from your description and optional domain selections. The examples assume you have installed the Python SDK and set ADAPTION_API_KEY.
from adaption import Adaption
client = Adaption()
dataset = client.datasets.invent( dataset_prompt=( "A dataset of medical question-answer pairs covering diagnoses, treatments, " "drug explanations, and healthcare roles. Each entry includes a prompt and a " "detailed, expert-generated response." ), rows=1000, name="Clinical Q&A",)
dataset_id = dataset.idprint(dataset_id, dataset.status) # runningDescribe the dataset
Section titled “Describe the dataset”To invent a dataset, provide at least one of the following parameters:
| Parameter | Notes |
|---|---|
dataset_prompt | Description of the data to generate. If omitted, a description is generated from your domain selections. Maximum 10,000 characters. |
domains | Domain codes to generate from. See Choose domains and subdomains. |
subdomains | Qualified subdomain codes that narrow generation. See Choose domains and subdomains. |
Request parameters
Section titled “Request parameters”| Parameter | Required | Notes |
|---|---|---|
rows | Yes | Number of rows to generate. Capped per request by your plan. See Generation limits. |
name | No | Display name for the invented dataset. |
training_type | No | instruction_dataset (default) or preference_pairs. See Choose the output format. |
translate | No | Translates a sample of the generated rows into other languages. See Expand across languages and locales. |
localize | No | Localizes a sample of the generated rows to country and language pairs. See Expand across languages and locales. |
estimate | No | Returns a credit estimate without creating or launching a dataset. Defaults to False. |
idempotency_key | No | Makes retries safe. Repeating a request with the same key returns the original dataset instead of starting generation again. Maximum 255 characters. |
Price a request first
Section titled “Price a request first”Set estimate=True to price the exact request. Nothing is generated or charged:
estimate = client.datasets.invent( dataset_prompt=( "A dataset of medical question-answer pairs covering diagnoses, treatments, " "drug explanations, and healthcare roles. Each entry includes a prompt and a " "detailed, expert-generated response." ), domains=["medical"], subdomains=[ "medical.symptoms_diagnosis", "medical.preventive_care", ], rows=1000, estimate=True,)
print(f"Estimated credits: {estimate.estimated_credits}")print(f"Available credits: {estimate.available_credits}")Generation limits
Section titled “Generation limits”Your organization’s plan sets the largest rows value a single request can ask for:
| Plan | Maximum rows per request |
|---|---|
| Free | 5,000 |
| Builder | 50,000 |
| Enterprise | 500,000 |
Legacy Pro and Plus subscriptions have the Builder limit. An organization without a subscription has the Free limit. The same limit applies when you invent a dataset in the app. It is separate from the per-launch limit for adapting an existing dataset.
- The limit applies to
rowsalone. Rows added bytranslateandlocalizedo not count toward it, although they are billed. On the Free plan,rows=5000withtranslate={"languages": ["es", "fr"], "sample_rate": 0.5}is within the limit and bills for up to 10,000 rows. rowsis a maximum. Surplus rows are trimmed, so the finished dataset can have fewer rows than requested but not more. Readrow_countfromdatasets.getfor the exact number.- Estimates do not check the limit.
estimate=Trueprices any row count. The limit is checked when you launch.
A request above the limit is rejected with a 400 response. Nothing is created or charged:
{ "statusCode": 400, "error": "Bad Request", "message": "Dataset size (20000) exceeds your plan limit of 5000 rows per launch. Upgrade your account", "code": "PLAN_UPGRADE_REQUIRED"}The SDK raises it as adaption.BadRequestError:
import adaption
try: dataset = client.datasets.invent( dataset_prompt="Customer support conversations for a consumer bank.", rows=20_000, )except adaption.BadRequestError as error: print(error.body)To generate more rows, upgrade your plan, or split the work across several requests and merge the results with datasets.combine.
Choose domains and subdomains
Section titled “Choose domains and subdomains”Fetch the current codes accepted by datasets.invent rather than hardcoding them:
response = client.datasets.invent_domains()
for domain in response.domains: print(domain.code, domain.title) for subdomain in domain.subdomains: print(" ", subdomain.code, subdomain.title)Domain and subdomain fields
Section titled “Domain and subdomain fields”| Field | Description |
|---|---|
code | The value to send in domains or subdomains. Domain codes are values such as medical; subdomain codes are qualified values such as medical.symptoms_diagnosis. |
title | Human-readable name for the domain or subdomain. |
subdomains | Subdomains available within a domain. An empty list means the domain has no subdomains. |
Narrow with subdomains
Section titled “Narrow with subdomains”Pass subdomain codes exactly as returned by invent_domains. subdomains is a flat list of qualified codes:
Here, the medical portion is narrowed to the selected subdomains. The legal portion draws from the full legal domain because no legal subdomains were provided.
dataset = client.datasets.invent( dataset_prompt=( "A dataset of medical question-answer pairs covering diagnoses, treatments, " "drug explanations, and healthcare roles. Each entry includes a prompt and a " "detailed, expert-generated response." ), domains=["medical", "legal"], subdomains=[ "medical.symptoms_diagnosis", "medical.preventive_care", ], rows=1000,)Combine multiple domains
Section titled “Combine multiple domains”Every code in domains contributes to the same generation run. For a domain without subdivisions, pass its domain code and omit subdomains for it.
Configure generation
Section titled “Configure generation”Configure the output format, expand languages, and make retries safe.
Choose the output format
Section titled “Choose the output format”training_type defaults to instruction_dataset. Set it to preference_pairs for chosen and rejected completion pairs:
dataset = client.datasets.invent( dataset_prompt=( "A dataset of medical question-answer pairs covering diagnoses, treatments, " "drug explanations, and healthcare roles. Each entry includes a prompt and a " "detailed, expert-generated response." ), domains=["medical"], rows=1000, training_type="preference_pairs",)Use instruction_dataset for standard supervised fine-tuning. Use preference_pairs for preference-based training such as DPO. The same formats are described in Configure Adaptive Data.
Expand across languages and locales
Section titled “Expand across languages and locales”translate and localize add rows in other languages, the same way as translating and localizing an existing dataset:
translateadds a translated variant of each sampled row for every target language.localizeadds a variant for every country and language pair, using locale-specific wording rather than direct translation alone.
Pass either one, or both in the same request. Each takes its own sample_rate: the fraction of invented rows expanded for each target, between 0.01 and 1. Credits are billed on the expanded output row count.
dataset = client.datasets.invent( dataset_prompt=( "A dataset of medical question-answer pairs covering diagnoses, treatments, " "drug explanations, and healthcare roles. Each entry includes a prompt and a " "detailed, expert-generated response." ), domains=["medical"], rows=1000, translate={ "languages": ["es", "fr"], "sample_rate": 0.25, }, localize={ "pairs": [{"country": "ES", "language": "ca"}], "sample_rate": 0.1, },)This request delivers and bills about 1,000 × (1 + 0.25 × 2 + 0.1 × 1) = 1,600 rows.
Unsupported language codes and country/language pairs return a 400 response before anything is created.
language_expansion is deprecated. It holds one mode at a time and cannot be combined with translate or localize. Requests that already use it keep working.
Make retries safe
Section titled “Make retries safe”Provide an idempotency key when a network failure might cause your application to retry the request:
dataset = client.datasets.invent( dataset_prompt=( "A dataset of medical question-answer pairs covering diagnoses, treatments, " "drug explanations, and healthcare roles. Each entry includes a prompt and a " "detailed, expert-generated response." ), domains=["medical"], rows=1000, idempotency_key="clinical-qa-2026-09-02",)Repeating the same request with this key returns the original dataset instead of starting another generation run.
Put it together
Section titled “Put it together”domains = ["medical"]subdomains = ["medical.symptoms_diagnosis"]
estimate = client.datasets.invent( dataset_prompt=( "A dataset of medical question-answer pairs covering diagnoses, treatments, " "drug explanations, and healthcare roles. Each entry includes a prompt and a " "detailed, expert-generated response." ), domains=domains, subdomains=subdomains, rows=1000, estimate=True,)print(f"Estimated credits: {estimate.estimated_credits}")
dataset = client.datasets.invent( dataset_prompt=( "A dataset of medical question-answer pairs covering diagnoses, treatments, " "drug explanations, and healthcare roles. Each entry includes a prompt and a " "detailed, expert-generated response." ), name="Clinical Q&A", domains=domains, subdomains=subdomains, rows=1000, training_type="instruction_dataset", idempotency_key="clinical-qa-2026-09-02",)dataset_id = dataset.idprint(dataset_id, dataset.status) # runningCheck status and download
Section titled “Check status and download”Poll datasets.get with the invented dataset ID until generation reports succeeded or failed.
Poll until generation finishes
Section titled “Poll until generation finishes”import time
while True: record = client.datasets.get(dataset_id) if record.status == "succeeded": break if record.status == "failed": error = record.error_data message = (error and error.message) or "unknown error" raise RuntimeError(f"Dataset generation failed: {message}") time.sleep(5)
print(f"Generated {record.row_count} rows")Download the rows
Section titled “Download the rows”datasets.download returns the generated rows in one of four formats:
file_format | You receive |
|---|---|
csv (default) | A CSV file with a header row. |
json | A JSON array with one object per row. |
jsonl | JSON Lines, one object per line. |
parquet | A gzipped tar archive (.tar.gz) of one or more Parquet files. |
client.datasets.download( dataset_id, file_format="jsonl",).write_to_file("clinical-qa.jsonl")parquet does not return a single .parquet file. Save the archive and extract it before reading:
import tarfile
client.datasets.download(dataset_id, file_format="parquet").write_to_file( "clinical-qa.tar.gz")
with tarfile.open("clinical-qa.tar.gz") as archive: archive.extractall("clinical-qa/", filter="data")Rows are available once the status is succeeded. Before that, and for a dataset whose generation failed, download returns 422. Unlike an adapted dataset, a failed generation has no partial rows to download. See datasets.download for streaming large files.
Columns in the download
Section titled “Columns in the download”The columns depend on training_type:
training_type | Columns |
|---|---|
instruction_dataset | enhanced_prompt, enhanced_completion |
preference_pairs | enhanced_prompt, chosen, rejected |
Invented rows have no source data, so there are no original_prompt or original_completion columns. When the request used translate or localize, each row also has target_language and target_language_code. Rows in the original language carry original in both.
Export to Hugging Face, Kaggle, or Google Sheets
Section titled “Export to Hugging Face, Kaggle, or Google Sheets”You can also publish an invented dataset from the Adaption app. Open the dataset once its status is succeeded, go to the Share tab, and choose a destination. The API and SDK do not include these exports.
| Destination | Before you export | What is created |
|---|---|---|
| Hugging Face | Save a Hugging Face access token with write access in API keys settings. | A dataset repository under your Hugging Face account, with JSON Lines files and a README. |
| Kaggle | Connect your Kaggle account in API keys settings. | A Kaggle dataset with a JSON Lines file and a README. |
| Google Sheets | Connect your Google account in API keys settings. | A spreadsheet in a new folder in your Google Drive. |
Exports are public by default: visible to everyone on Hugging Face or Kaggle, and viewable by anyone with the link in Google Sheets. Private exports require a Builder or Enterprise plan.
After an export finishes, read its URL with datasets.get_export_links:
links = client.datasets.get_export_links(dataset_id)print(links.huggingface, links.kaggle, links.google_sheets)Complete example
Section titled “Complete example”import time
from adaption import Adaption
client = Adaption()
domains = ["medical"]subdomains = ["medical.symptoms_diagnosis"]
estimate = client.datasets.invent( dataset_prompt=( "A dataset of medical question-answer pairs covering diagnoses, treatments, " "drug explanations, and healthcare roles. Each entry includes a prompt and a " "detailed, expert-generated response." ), domains=domains, subdomains=subdomains, rows=1000, estimate=True,)print(f"Estimated credits: {estimate.estimated_credits}")
dataset = client.datasets.invent( dataset_prompt=( "A dataset of medical question-answer pairs covering diagnoses, treatments, " "drug explanations, and healthcare roles. Each entry includes a prompt and a " "detailed, expert-generated response." ), name="Clinical Q&A", domains=domains, subdomains=subdomains, rows=1000, training_type="instruction_dataset", idempotency_key="clinical-qa-2026-09-02",)dataset_id = dataset.idprint(dataset_id, dataset.status) # running
assert dataset_id is not None
while True: record = client.datasets.get(dataset_id) if record.status == "succeeded": break if record.status == "failed": error = record.error_data message = (error and error.message) or "unknown error" raise RuntimeError(f"Dataset generation failed: {message}") time.sleep(5)
print(f"Generated {record.row_count} rows")
client.datasets.download( dataset_id, file_format="jsonl",).write_to_file("clinical-qa.jsonl")To train on the generated dataset, pass its ID to autoscientist.create:
run = client.autoscientist.create(dataset_id=dataset_id)print(run.id, run.status)