Datasets
These endpoints allow you to programmatically interact with your datasets. You can start by configuring datasets in Autoblocks.
When using the TypeScript SDK, you can generate types for your dataset items. See generate types.
Retrieve dataset items for the latest revision in a schema version
This endpoint returns a list of dataset items for the latest revision in a schema version.
Query parameters
- Name
splits
- Type
- string[]
- Description
A list of splits to filter by.
Code samples for getting a list of test cases
curl 'https://api.autoblocks.ai/datasets/My%20Dataset/schema-versions/1' \
--header "Authorization: Bearer $AUTOBLOCKS_API_KEY"
{
"name": "My Dataset",
"schemaVersion": 1,
"revisionId": "cljzx8zhd00077w3sqredd0fz",
"items": [
{
"id": "cljzx8zhd00077w3sqredd0fz",
"splits": ["split-1"],
"data": {
"input": "My Input"
}
}
]
}
Retrieve dataset items for a specific revision in a schema version
This endpoint returns a list of dataset items for a specific revision in a schema version.
Query parameters
- Name
splits
- Type
- string[]
- Description
A list of splits to filter by.
Code samples for getting a list of test cases
curl 'https://api.autoblocks.ai/datasets/My%20Dataset/schema-versions/1/revisions/cljzx8zhd00077w3sqredd0fz' \
--header "Authorization: Bearer $AUTOBLOCKS_API_KEY"
{
"name": "My Dataset",
"schemaVersion": 1,
"revisionId": "cljzx8zhd00077w3sqredd0fz",
"items": [
{
"id": "cljzx8zhd00077w3sqredd0fz",
"splits": ["split-1"],
"data": {
"input": "My Input"
}
}
]
}
Add an item to a dataset
This endpoint allows you to add a new item to a dataset. The item will be validated against the dataset's schema.
Request Body
- Name
data
- Type
- object
- Description
The data for the new item. Must conform to the dataset's schema.
- Name
splits
- Type
- string[]
- Description
Array of split names to assign the item to.
Code samples for adding a dataset item
curl -X POST 'https://api.autoblocks.ai/datasets/<datasetExternalId>/items' \
--header "Authorization: Bearer $AUTOBLOCKS_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"data": {
"input": "example input",
"output": "example output"
},
"splitNames": ["train", "test"]
}'
{
"id": "cljzx8zhd00077w3sqredd0fz"
}
Update a dataset item
This endpoint allows you to update an existing item in a dataset and optionally assign it to specific splits.
Request Body
- Name
data
- Type
- object
- Description
The updated data for the item. Must conform to the dataset's schema.
- Name
splits
- Type
- string[]
- Description
Array of split names to assign the item to.
Code samples for updating a dataset item
curl -X PUT 'https://api.autoblocks.ai/datasets/<datasetExternalId>/items/<itemId>' \
--header "Authorization: Bearer $AUTOBLOCKS_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"data": {
"input": "updated input",
"output": "updated output"
},
"splitNames": ["train", "test"]
}'
{
"id": "cljzx8zhd00077w3sqredd0fz"
}
Delete a dataset item
This endpoint allows you to delete an item from a dataset. This operation creates a new revision without the specified item.
Code samples for deleting a dataset item
curl -X DELETE 'https://api.autoblocks.ai/datasets/<datasetExternalId>/items/<itemId>' \
--header "Authorization: Bearer $AUTOBLOCKS_API_KEY"
{
"id": "cljzx8zhd00077w3sqredd0fz"
}