Skip to main content

AI Dataset Preparations - TypeScript SDK

client.datasets.preparations manages AI-assisted dataset preparation and labeling tasks. Request bodies use the server wire names shown below.

Overview​

Available Operations​

MethodDescription
clusterOptions()List clusters selectable for preparation workloads.
availableProviderKeys()List caller-owned provider keys suitable for labeling.
preview(body)Preflight the selected cluster.
create(body)Create a preparation task.
list(body)Search and page preparation tasks.
get(options)Read task configuration, progress, and artifacts.
update(id, body)Update an editable preparation task.
generateRules(options)Start labeling-rule generation.
startLabeling(body)Start labeling with optional rule text.
action(body)Cancel, retry, or delete a task.
downloadUrl(body)Create a temporary URL for a task artifact.

clusterOptions​

List clusters selectable for preparation workloads.

Request​

This method has no parameters and sends no request body.

Response​

WorkloadClusterOptionVO[].

availableProviderKeys​

List caller-owned provider keys suitable for labeling.

Request​

This method has no parameters and sends no request body.

Response​

PrepProviderKeysVO.

preview​

Preflight the selected cluster.

Request​

Body requires clusterId.

Response​

WorkloadAdmissionPreviewVO.

create​

Create a preparation task.

Request​

PrepTaskCreateRequest; required fields below.

Response​

PrepTaskVO.

list​

Search and page preparation tasks.

Request​

PrepTaskQueryRequest.

Response​

PageResult<PrepTaskVO>.

get​

Read task configuration, progress, and artifacts.

Request​

{id} required.

Response​

PrepTaskDetailVO.

update​

Update an editable preparation task.

Request​

id and PrepTaskUpdateRequest required.

Response​

Updated PrepTaskVO.

generateRules​

Start labeling-rule generation.

Request​

{id} required.

Response​

null.

startLabeling​

Start labeling with optional rule text.

Request​

preparationId required; optional labelRules.

Response​

null.

action​

Cancel, retry, or delete a task.

Request​

preparationId and action (CANCEL, RETRY, DELETE) required.

Response​

null.

downloadUrl​

Create a temporary URL for a task artifact.

Request​

preparationId plus artifactPath or storageRef.

Response​

DownloadUrl.

Field Reference and Examples​

Use client.waitForDatasetPreparation(id, { until: "rules_ready" }) after rule generation, and omit until after labeling to wait for completed. The rules_ready target also succeeds when the task has already advanced to a later successful processing phase or completed between polls.

Create body fields

FieldTypeRequiredConstraints
taskNamestringYesMaximum 255 characters; no control characters.
clusterIdnumberYesSelected cluster ID.
modelTypestringYesllm or vlm.
postTrainingMethodstringYessft or ref_distill.
preparationModestringYesbase or sss-bench.
providerKeyIdsnumber[]YesUp to 50 IDs; may be empty when the mode does not require one.
scenariostringNoScenario text, maximum 4000 characters.
autoSplitPercentnumberNo1..100.
generatedDatasetFileLinesnumberNoRequested generated record count.
processingModestringNoauto or manual.
unlabeledDataFiles / evaluationDataFilesDatasetFileItem[]NoUp to 100 items each.
tBenchConfigobjectNoBenchmark-mode options.

DatasetFileItem accepts fileName, filePath, fileSize, storageRef, sourceType, and preparationGroup. Update accepts the same configuration fields as create, but all are optional.

Key response fields: PrepTaskVO includes id, taskName, clusterId, clusterName, status, progress, progressInfo, savedDatasetId, savedDatasetName, error, resourcePreview, createdAt, and updatedAt. PrepTaskDetailVO additionally includes configuration, selected keys, input files, artifacts, rules, execution summary, and result summary.

const clusters = await client.datasets.preparations.clusterOptions();
const providerKeys = await client.datasets.preparations.availableProviderKeys();
const resource = await client.datasets.preparations.preview({ clusterId: 1 });

const task = await client.datasets.preparations.create<{ id: number }>({
taskName: "prepare-example-dataset",
clusterId: 1,
modelType: "llm",
postTrainingMethod: "sft",
preparationMode: "base",
providerKeyIds: [],
});
const page = await client.datasets.preparations.list({
taskName: "prepare-example",
status: ["pending", "completed"],
pageNum: 1,
pageSize: 20,
});
const detail = await client.datasets.preparations.get({ id: task.id });
const updated = await client.datasets.preparations.update(task.id, {
taskName: "new-name",
});
await client.datasets.preparations.generateRules({ id: task.id });
await client.datasets.preparations.startLabeling({
preparationId: task.id,
labelRules: "Return one concise label.",
});
const artifact = await client.datasets.preparations.downloadUrl({
preparationId: task.id,
artifactPath: "outputs/result.jsonl",
});
await client.datasets.preparations.action({
preparationId: task.id,
action: "CANCEL",
});

All methods use the shared authentication and typed error behavior described in Response Conventions and Retry and Security.