Datasets - TypeScript SDK
client.datasets manages training and evaluation datasets. The high-level
upload(...) workflow signs, transfers, commits, and registers local files in
one call.
Overview
Available Operations
| Method | Description |
|---|---|
upload(files, options) | Upload one file, a directory, or a file list and create a Dataset. |
list(options?) | Search and page datasets. |
get(id) | Read one Dataset. |
preview(id, options?) | Preview parsed records without downloading the object. |
downloadUrl(body) | Create a temporary URL for one Dataset file. |
update(id, body) | Update Dataset metadata or committed file references. |
delete(id) | Delete an unreferenced Dataset. |
upload
Upload one file, a directory, or a file list and create a Dataset.
Request
files; required name, datasetType, trainingCategory; optional onProgress.
Response
Created DatasetVO.
list
Search and page datasets.
Request
Optional datasetName, datasetType, trainingCategory, orderBy, orderDirection, pageNum, pageSize, scope.
Response
PageResult<DatasetVO>.
get
Read one Dataset.
Request
id required.
Response
DatasetVO.
preview
Preview parsed records without downloading the object.
Request
id required; optional {limit, cursor}.
Response
DatasetPreviewVO.
downloadUrl
Create a temporary URL for one Dataset file.
Request
Body requires datasetId and zero-based fileIndex.
Response
DownloadUrl.
update
Update Dataset metadata or committed file references.
Request
id and body required.
Response
Updated DatasetVO.
delete
Delete an unreferenced Dataset.
Request
id required.
Response
null.
Field Reference and Examples
upload(...) options
| Option | Type | Required | Values |
|---|---|---|---|
name | string | Yes | Non-empty Dataset name. |
datasetType | string | Yes | training or evaluation. |
trainingCategory | string | Yes | sft-llm, dpo-llm, sft-vlm, dpo-vlm, or cpt-llm. |
onProgress | (progress: UploadProgress) => void | No | Same progress object as My Model upload. |
Update body fields: optional datasetName, type, trainingCategory, and
files. Key DatasetVO fields: id, datasetName, type,
trainingCategory, files, fileSizeTotal, owner, createdAt, updatedAt.
DatasetPreviewVO contains items, totalRecords, datasetRevision,
hasNext, and nextCursor.
const dataset = await client.datasets.upload<{ id: number }>("./train.jsonl", {
name: "example-training-dataset",
datasetType: "training",
trainingCategory: "sft-llm",
});
const page = await client.datasets.list({
datasetName: "example",
datasetType: ["training"],
trainingCategory: ["sft-llm"],
orderBy: "createdAt",
orderDirection: "DESC",
pageNum: 1,
pageSize: 20,
scope: "self",
});
const detail = await client.datasets.get(dataset.id);
const preview = await client.datasets.preview(dataset.id, { limit: 20 });
const download = await client.datasets.downloadUrl({
datasetId: dataset.id,
fileIndex: 0,
});
const updated = await client.datasets.update(dataset.id, {
datasetName: "renamed-dataset",
});
await client.datasets.delete(dataset.id);
All methods use the shared authentication and typed error behavior described in Response Conventions and Retry and Security.