Skip to content
SupportLogin
Adaptive Data
Edit on GitHub

Expand your data

Augment, translate, or localize rows to increase dataset size after import or adaptation.

After you import a dataset and optionally run Adaptive Data, you can increase row count without re-running the full adaptation pipeline. Each method below returns a new dataset that includes your source rows plus the added ones.

The SDK examples assume you have configured the Python SDK and set ADAPTION_DATASET_ID to a dataset that is ready to expand:

import os
from adaption import Adaption
client = Adaption()
dataset_id = os.environ["ADAPTION_DATASET_ID"]

datasets.augment retrieves additional rows from the curated pool and returns them as a new dataset. Use it when you want more examples in the same topic mix or broader coverage across topics:

  • Domain rows match topics in your dataset.
  • General rows come from other topics to broaden diversity.
estimate = client.datasets.augment(
dataset_id,
domain_rows=3_000,
general_rows=1_000,
estimate=True,
)
print(f"Estimated credits: {estimate.estimated_credits_consumed}")
response = client.datasets.augment(
dataset_id,
domain_rows=3_000,
general_rows=1_000,
)
print(response.dataset_id, response.status)

The response carries the new dataset’s id and its current status; both are None for an estimate. Wait for the new dataset before you download or train on it:

from adaption import DatasetTimeout
try:
final = client.datasets.wait_for_completion(response.dataset_id)
except DatasetTimeout as exc:
print(exc.resource_id, exc.last_status)
raise
print(final.status, final.row_count)

wait_for_completion backs off from 2 to 30 seconds and has a one-hour default timeout. A timeout stops waiting, not the expansion job. Call it again with the same dataset ID to resume tracking. The same wait applies after translate and localize.

Omit either row parameter to skip that type of addition. Augmentation is billed on the rows retrieved. See the augment reference for current limits and request fields.

datasets.translate converts a sample of existing rows into other languages. Adaptive Data supports up to 242 languages. Provide ISO 639-1 language codes. sample_rate is the fraction of source rows expanded for each target language:

estimate = client.datasets.translate(
dataset_id,
sample_rate=0.25,
languages=["es", "fr"],
estimate=True,
)
print(f"Estimated credits: {estimate.estimated_credits_consumed}")
response = client.datasets.translate(
dataset_id,
sample_rate=0.25,
languages=["es", "fr"],
)
print(response.dataset_id, response.status)

With two target languages and a 0.25 sample rate, the output contains approximately 1 + (0.25 × 2) = 1.5 times as many rows as the input.

datasets.localize adapts rows for both a language and a country, including locale-specific wording rather than direct translation alone. Provide country/language pairs using ISO 3166-1 alpha-2 country codes and ISO 639-1 language codes:

response = client.datasets.localize(
dataset_id,
sample_rate=0.25,
pairs=[
{"country": "CA", "language": "fr"},
{"country": "MX", "language": "es"},
],
)
print(response.dataset_id, response.status)

Each pair creates a country- and language-specific variant rather than only translating the text.

For recipes, preference pairs, row limits, and brand controls on an adaptation run, see Configure Adaptive Data.

The methods on this page each write a new dataset and leave the source unchanged. datasets.run also accepts a language_expansion setting; that path stores the setting on the dataset and expands rows inside its own adaptation run, without creating a new dataset. See the run reference for that shape.