Skip to main content
Datasets are the foundation for experiment runs. The @arizeai/phoenix-client/datasets entrypoint covers dataset creation (which upserts by name), record inspection, example appends, split management, and both global dataset-label resources and their dataset assignments.

Relevant Source Files

  • src/datasets/createDataset.ts for the exact return shape and upsert-by-name behavior
  • src/datasets/datasetLabelTypes.ts for the generated dataset-label request and response types
  • src/datasets/datasetLabelAssignments.ts for dataset label assignment helpers

Create A Dataset

id is optional. When you do provide it, give every example its own value: example IDs are unique per dataset, so reusing one across examples in the same dataset is an error. A stable, unique id is what createDataset() matches on when it upserts, and what you can hand to the split helpers below instead of the server-generated nodeId. Omit id and the server generates one for you.

Upsert Or Append

createDataset() upserts by name: re-running it with the same name updates the existing dataset to match the examples you pass, and an unchanged upload is a no-op. To keep existing examples and add more, use appendDatasetExamples() instead of re-running createDataset() with the extra examples.
createDataset() returns { datasetId }, so you can pass that object directly as the dataset selector for append or experiment calls.

Organize Datasets With Labels

Dataset label assignment helpers accept either a dataset name or a Phoenix GlobalID. Label IDs are Phoenix GlobalIDs returned by the dataset-label API or shown in Phoenix. The following workflow creates a shared label, applies it to a dataset, and then uses replacement to make the dataset’s organization declarative:
Assignment endpoints require Phoenix server 17.16.0 or newer. Adding and removing an assignment are idempotent, while replaceLabelsForDataset() treats labelIds as the complete desired set.

Read Back Dataset State

Use getDataset, getDatasetExamples, and getDatasetInfo to inspect datasets after creation.

Manage Splits On An Existing Dataset

Use createDatasetSplit, updateDatasetSplit, and deleteDatasetSplit to manage train, test, validation, or other named subsets after a dataset exists. Select the dataset by name or GlobalID. Example membership accepts either the user-provided id or Phoenix nodeId returned by getDatasetExamples.
Split names are unique across the Phoenix instance. Creating or renaming a split to an existing name fails with HTTP 409. These helpers require Phoenix server 19.20.0 or newer. Servers on 19.20.0 through 20.15.0 resolve membership by nodeId only — user-provided id values are accepted from the release that follows 20.15.0, so pass nodeId when you target an older server.

Manage Dataset Label Resources

Dataset labels are reusable, global resources for organizing datasets. The datasets entrypoint provides typed helpers to list, get, create, update, and delete those resources.
Dataset label resources and dataset label assignments are different. These helpers manage the global resource itself; they do not attach a label to a dataset. An assignment links an existing resource to one dataset. Removing an assignment preserves the label resource, while deleting the resource removes it from every dataset where it is assigned.

Create And Read Labels

Names are unique across Phoenix. Creating a label whose name already exists rejects with an HttpError whose status is 409.

List Labels With Cursor Pagination

listDatasetLabels() returns one page at a time. Pass nextCursor from one result as cursor on the next request.

Update Or Delete A Label

Updates are partial: omitted fields stay unchanged, and description: null clears the description. Deleting a global label also removes every assignment of that label.
Dataset assignments use the separate /v1/datasets/{dataset_identifier}/labels routes. They control which existing labels are applied to a dataset and do not create, update, or delete the global resources documented here.

Source Map

  • src/datasets/createDataset.ts
  • src/datasets/appendDatasetExamples.ts
  • src/datasets/getDataset.ts
  • src/datasets/getDatasetExamples.ts
  • src/datasets/getDatasetInfo.ts
  • src/datasets/datasetLabelTypes.ts
  • src/datasets/listDatasetLabels.ts
  • src/datasets/getDatasetLabel.ts
  • src/datasets/createDatasetLabel.ts
  • src/datasets/updateDatasetLabel.ts
  • src/datasets/deleteDatasetLabel.ts
  • src/datasets/datasetLabelAssignments.ts
  • src/datasets/createDatasetSplit.ts
  • src/datasets/updateDatasetSplit.ts
  • src/datasets/deleteDatasetSplit.ts