Add translated rows to a dataset
Translates a sample of this dataset’s rows into each target language and returns the result as a new dataset, leaving this one unchanged. The new dataset carries this dataset’s rows alongside the translated ones, so it can be trained on or downloaded directly. Poll GET /datasets/{dataset_id}/status on the returned id until it reaches succeeded. To adapt rows to a country as well as a language, use POST /datasets/{dataset_id}/localize. Set estimate=true to price the request without starting a run.
Parameters
Fraction of this dataset’s rows to expand, per target. At 0.25 with two targets, a 1,000-row dataset gains 500 rows and the new dataset holds 1,500.
When true, validates the request and returns the estimated credit cost without starting a run or creating a dataset.
Add translated rows to a dataset
import os
from adaption import Adaption
client = Adaption(
api_key=os.environ.get("ADAPTION_API_KEY"), # This is the default and can be omitted
)
response = client.datasets.translate(
dataset_id="dataset_id",
sample_rate=0.25,
languages=["es", "fr"],
)
print(response.dataset_id){
"dataset_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "running",
"estimated_credits_consumed": 5,
"estimate": true,
"estimated_new_rows": 500
}Returns Examples
{
"dataset_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "running",
"estimated_credits_consumed": 5,
"estimate": true,
"estimated_new_rows": 500
}