llama-stack-mirror/docs/docs/api/register-a-new-dataset.api.mdx
2025-09-23 09:48:43 -07:00

71 lines
No EOL
14 KiB
Text

---
id: register-a-new-dataset
title: "Register a new dataset."
description: "Register a new dataset."
sidebar_label: "Register a new dataset."
hide_title: true
hide_table_of_contents: true
api: eJztWm2P27gR/iusvqQFvHYuuOv1XBTB3u0essWlWezuoSjWxoKWaIsXilRIyo5h+L/3GVKy5dc4L2gTwAsklsghOTPPzHA41CKxwpVGO+GS/iJ58fw5/WTCpVaWXhqd9JNLdsU9d8J3k06SGu2F9kTFy1LJlBNV7w9HpIvEpbkoOD35eSkw2Iz+EKnHwNKaUlgv40IywyRyLIVt0TpvpZ4ky0A8BYl9Anemsql4ktlxwgP9sWG7o5MIXRVJ/zEpTCYU3l0uhcrwMAW3xj5lIzxnUWzqTg0NfBpXOg1a6SQjodO84PYtnr0xqv55mlhTlVHeovTJMKjMQWGt6TIx5pXabmvr/AH8MjNmjfwdxtWMzx17Vo94xsbGsvrFBVVUtjTuqLTo9xfecqnR3iuEc3wCPEAw5ar3rhKOlr/g2s0ATN3ckDXNw21eb+PCxK7PRcMTkzoL1qEnTHqHV9hNJjJWgUewG+XatTayNRY7GTQ3lpPKBhsLArcWAH9GizdjCPYhaztkBQ0ylZUbqNA7WKSfPaO2kGqJnHLNRlDEyEPFEHUMG2Cc/X5302XX3UmXXbBBkntfun6vV8xnYuSkF93UFHijSbrkR2qQBELlxpFup4ca+qmb/n2EZf/6fWcRf59q51wOkmQJ/nmWSeKSq9uWOsZcOdGB37+rpBUZ2UWQMMoLdL30igQG2wTGfQRqW+7LldQ+50dFhyo/FyBrZm4DodAAEcPveiC3ls9BCK0Wbl8U2q+Sxa4l6UqpNuMj+Lbgut0EpxrBH1otq7izxdCuApZDAuiwJUnHHOIQFCk1IyFXBvTIFoOk8clB0mePeLdgjp4HCbzLDpIOnmpjiM2vhFKmw2bGquxPAzDENkZx56TznKg/OHS4ZMNPMq+AVcu+7vB+koFtaQIsgFYSbSE1Rych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Bsh8cw1vMVxw231NwsSAseu9hoAmuu9bW+71q5CVA9VYr9FG8MIKSc1RQl9084ToPJH/Pc6RlJHHkzgUGSp5bUyihse+qdW25cnTLS/Gn/KyA9X60+aJq8mEwSSMU8F+FCKFxwmk77tOUnaeMdfOsRp/48QcfbOSWXTOGl8Cqb8dUQl/Dvf/H479znni5zzRc755vccKc43v+eAcb75/QI3vwT9oStfAj1gD8RaoyI4r+cNGZAJDle/7v12ct+yN1c7CfbNmCpyrL4wzjp0RgLZTCpFrj4RWlCpPJTrPsIMdu6a27ZQFyrqUkZzGxaQXs/hbSUiyLnBazi9h1qGz/HWm37XW307iUVCcdIFYCtLNRUKwIirXM8vcowU2UVIoy9CHk3BOGxFTqSIh34eBl41EedxSH0Ui+/WlZLrdU1nVek4XNBYn6BqVOLuEzab1tetLRPegrNFREWyMFOtv99IEHZPgrD7ulTG649aSQsR7+l3e0yAKotuo8bG21W/9swh4Ndm4Qaabf3hXCfCAVvorDRS+3jCxiySTtc2ls2y8PEolZDpLOPipNyKAR3eVfB0b3YnH9E1qBIQBuqsuXpNH/q6YPak9YKH4pSOKcPh2teGBlq1riNDasS8eO97pQK2MU0I5dZofo+1dlu1ODIy6liEbfp3q5ZLaob52HmsuoWC7ogQfKSgkAue0cfTMLy3AiTJL5G1i4cYQakqESLLdkmOgkwccZmmovRHaYctD7p9c/8A4lFd9qMvp2l35TOK1/i/n9C5LKgqxMrQtkgU15MKOKA/zkl//wVusQXB
sidebar_class_name: "post api-method"
info_path: docs/api/llama-stack-specification
custom_edit_url: null
---
import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import ParamsDetails from "@theme/ParamsDetails";
import RequestSchema from "@theme/RequestSchema";
import StatusCodes from "@theme/StatusCodes";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";
import Heading from "@theme/Heading";
<Heading
as={"h1"}
className={"openapi__heading"}
children={"Register a new dataset."}
>
</Heading>
<MethodEndpoint
method={"post"}
path={"/v1/datasets"}
context={"endpoint"}
>
</MethodEndpoint>
Register a new dataset.
<Heading
id={"request"}
as={"h2"}
className={"openapi-tabs__heading"}
children={"Request"}
>
</Heading>
<ParamsDetails
parameters={[]}
>
</ParamsDetails>
<RequestSchema
title={"Body"}
body={{"content":{"application/json":{"schema":{"type":"object","properties":{"purpose":{"type":"string","enum":["post-training/messages","eval/question-answer","eval/messages-answer"],"description":"The purpose of the dataset. One of: - \"post-training/messages\": The dataset contains a messages column with list of messages for post-training. { \"messages\": [ {\"role\": \"user\", \"content\": \"Hello, world!\"}, {\"role\": \"assistant\", \"content\": \"Hello, world!\"}, ] } - \"eval/question-answer\": The dataset contains a question column and an answer column for evaluation. { \"question\": \"What is the capital of France?\", \"answer\": \"Paris\" } - \"eval/messages-answer\": The dataset contains a messages column with list of messages and an answer column for evaluation. { \"messages\": [ {\"role\": \"user\", \"content\": \"Hello, my name is John Doe.\"}, {\"role\": \"assistant\", \"content\": \"Hello, John Doe. How can I help you today?\"}, {\"role\": \"user\", \"content\": \"What's my name?\"}, ], \"answer\": \"John Doe\" }"},"source":{"description":"The data source of the dataset. Ensure that the data source schema is compatible with the purpose of the dataset. Examples: - { \"type\": \"uri\", \"uri\": \"https://mywebsite.com/mydata.jsonl\" } - { \"type\": \"uri\", \"uri\": \"lsfs://mydata.jsonl\" } - { \"type\": \"uri\", \"uri\": \"data:csv;base64,{base64_content}\" } - { \"type\": \"uri\", \"uri\": \"huggingface://llamastack/simpleqa?split=train\" } - { \"type\": \"rows\", \"rows\": [ { \"messages\": [ {\"role\": \"user\", \"content\": \"Hello, world!\"}, {\"role\": \"assistant\", \"content\": \"Hello, world!\"}, ] } ] }","oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"uri","default":"uri"},"uri":{"type":"string","description":"The dataset can be obtained from a URI. E.g. - \"https://mywebsite.com/mydata.jsonl\" - \"lsfs://mydata.jsonl\" - \"data:csv;base64,{base64_content}\""}},"additionalProperties":false,"required":["type","uri"],"title":"URIDataSource","description":"A dataset that can be obtained from a URI."},{"type":"object","properties":{"type":{"type":"string","const":"rows","default":"rows"},"rows":{"type":"array","items":{"type":"object","additionalProperties":{"oneOf":[{"type":"null"},{"type":"boolean"},{"type":"number"},{"type":"string"},{"type":"array"},{"type":"object"}]}},"description":"The dataset is stored in rows. E.g. - [ {\"messages\": [{\"role\": \"user\", \"content\": \"Hello, world!\"}, {\"role\": \"assistant\", \"content\": \"Hello, world!\"}]} ]"}},"additionalProperties":false,"required":["type","rows"],"title":"RowsDataSource","description":"A dataset stored in rows."}],"discriminator":{"propertyName":"type","mapping":{"uri":{"type":"object","properties":{"type":{"type":"string","const":"uri","default":"uri"},"uri":{"type":"string","description":"The dataset can be obtained from a URI. E.g. - \"https://mywebsite.com/mydata.jsonl\" - \"lsfs://mydata.jsonl\" - \"data:csv;base64,{base64_content}\""}},"additionalProperties":false,"required":["type","uri"],"title":"URIDataSource","description":"A dataset that can be obtained from a URI."},"rows":{"type":"object","properties":{"type":{"type":"string","const":"rows","default":"rows"},"rows":{"type":"array","items":{"type":"object","additionalProperties":{"oneOf":[{"type":"null"},{"type":"boolean"},{"type":"number"},{"type":"string"},{"type":"array"},{"type":"object"}]}},"description":"The dataset is stored in rows. E.g. - [ {\"messages\": [{\"role\": \"user\", \"content\": \"Hello, world!\"}, {\"role\": \"assistant\", \"content\": \"Hello, world!\"}]} ]"}},"additionalProperties":false,"required":["type","rows"],"title":"RowsDataSource","description":"A dataset stored in rows."}}},"title":"DataSource"},"metadata":{"type":"object","additionalProperties":{"oneOf":[{"type":"null"},{"type":"boolean"},{"type":"number"},{"type":"string"},{"type":"array"},{"type":"object"}]},"description":"The metadata for the dataset. - E.g. {\"description\": \"My dataset\"}."},"dataset_id":{"type":"string","description":"The ID of the dataset. If not provided, an ID will be generated."}},"additionalProperties":false,"required":["purpose","source"],"title":"RegisterDatasetRequest"}}},"required":true}}
>
</RequestSchema>
<StatusCodes
id={undefined}
label={undefined}
responses={{"200":{"description":"A Dataset.","content":{"application/json":{"schema":{"type":"object","properties":{"identifier":{"type":"string"},"provider_resource_id":{"type":"string"},"provider_id":{"type":"string"},"type":{"type":"string","enum":["model","shield","vector_db","dataset","scoring_function","benchmark","tool","tool_group","prompt"],"const":"dataset","default":"dataset","description":"Type of resource, always 'dataset' for datasets"},"purpose":{"type":"string","enum":["post-training/messages","eval/question-answer","eval/messages-answer"],"description":"Purpose of the dataset indicating its intended use"},"source":{"description":"Data source configuration for the dataset","oneOf":[{"type":"object","properties":{"type":{"type":"string","const":"uri","default":"uri"},"uri":{"type":"string","description":"The dataset can be obtained from a URI. E.g. - \"https://mywebsite.com/mydata.jsonl\" - \"lsfs://mydata.jsonl\" - \"data:csv;base64,{base64_content}\""}},"additionalProperties":false,"required":["type","uri"],"title":"URIDataSource","description":"A dataset that can be obtained from a URI."},{"type":"object","properties":{"type":{"type":"string","const":"rows","default":"rows"},"rows":{"type":"array","items":{"type":"object","additionalProperties":{"oneOf":[{"type":"null"},{"type":"boolean"},{"type":"number"},{"type":"string"},{"type":"array"},{"type":"object"}]}},"description":"The dataset is stored in rows. E.g. - [ {\"messages\": [{\"role\": \"user\", \"content\": \"Hello, world!\"}, {\"role\": \"assistant\", \"content\": \"Hello, world!\"}]} ]"}},"additionalProperties":false,"required":["type","rows"],"title":"RowsDataSource","description":"A dataset stored in rows."}],"discriminator":{"propertyName":"type","mapping":{"uri":{"type":"object","properties":{"type":{"type":"string","const":"uri","default":"uri"},"uri":{"type":"string","description":"The dataset can be obtained from a URI. E.g. - \"https://mywebsite.com/mydata.jsonl\" - \"lsfs://mydata.jsonl\" - \"data:csv;base64,{base64_content}\""}},"additionalProperties":false,"required":["type","uri"],"title":"URIDataSource","description":"A dataset that can be obtained from a URI."},"rows":{"type":"object","properties":{"type":{"type":"string","const":"rows","default":"rows"},"rows":{"type":"array","items":{"type":"object","additionalProperties":{"oneOf":[{"type":"null"},{"type":"boolean"},{"type":"number"},{"type":"string"},{"type":"array"},{"type":"object"}]}},"description":"The dataset is stored in rows. E.g. - [ {\"messages\": [{\"role\": \"user\", \"content\": \"Hello, world!\"}, {\"role\": \"assistant\", \"content\": \"Hello, world!\"}]} ]"}},"additionalProperties":false,"required":["type","rows"],"title":"RowsDataSource","description":"A dataset stored in rows."}}},"title":"DataSource"},"metadata":{"type":"object","additionalProperties":{"oneOf":[{"type":"null"},{"type":"boolean"},{"type":"number"},{"type":"string"},{"type":"array"},{"type":"object"}]},"description":"Additional metadata for the dataset"}},"additionalProperties":false,"required":["identifier","provider_id","type","purpose","source","metadata"],"title":"Dataset","description":"Dataset resource for storing and accessing training or evaluation data."}}}},"400":{"description":"The request was invalid or malformed","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer","description":"HTTP status code"},"title":{"type":"string","description":"Error title, a short summary of the error which is invariant for an error type"},"detail":{"type":"string","description":"Error detail, a longer human-readable description of the error"},"instance":{"type":"string","description":"(Optional) A URL which can be used to retrieve more information about the specific occurrence of the error"}},"additionalProperties":false,"required":["status","title","detail"],"title":"Error","description":"Error response from the API. Roughly follows RFC 7807."},"example":{"status":400,"title":"Bad Request","detail":"The request was invalid or malformed"}}}},"429":{"description":"The client has sent too many requests in a given amount of time","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer","description":"HTTP status code"},"title":{"type":"string","description":"Error title, a short summary of the error which is invariant for an error type"},"detail":{"type":"string","description":"Error detail, a longer human-readable description of the error"},"instance":{"type":"string","description":"(Optional) A URL which can be used to retrieve more information about the specific occurrence of the error"}},"additionalProperties":false,"required":["status","title","detail"],"title":"Error","description":"Error response from the API. Roughly follows RFC 7807."},"example":{"status":429,"title":"Too Many Requests","detail":"You have exceeded the rate limit. Please try again later."}}}},"500":{"description":"The server encountered an unexpected error","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer","description":"HTTP status code"},"title":{"type":"string","description":"Error title, a short summary of the error which is invariant for an error type"},"detail":{"type":"string","description":"Error detail, a longer human-readable description of the error"},"instance":{"type":"string","description":"(Optional) A URL which can be used to retrieve more information about the specific occurrence of the error"}},"additionalProperties":false,"required":["status","title","detail"],"title":"Error","description":"Error response from the API. Roughly follows RFC 7807."},"example":{"status":500,"title":"Internal Server Error","detail":"An unexpected error occurred. Our team has been notified."}}}},"default":{"description":"An unexpected error occurred","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"integer","description":"HTTP status code"},"title":{"type":"string","description":"Error title, a short summary of the error which is invariant for an error type"},"detail":{"type":"string","description":"Error detail, a longer human-readable description of the error"},"instance":{"type":"string","description":"(Optional) A URL which can be used to retrieve more information about the specific occurrence of the error"}},"additionalProperties":false,"required":["status","title","detail"],"title":"Error","description":"Error response from the API. Roughly follows RFC 7807."},"example":{"status":0,"title":"Error","detail":"An unexpected error occurred"}}}}}}
>
</StatusCodes>