DatasetFactory
Creates, retrieves, and lists datasets in your project.
Access via client.datasets.
const datasets = await client.datasets.list();
const dataset = await client.datasets.get("golden-set");
get()
Retrieve a dataset by name, including all its examples.
async function get(name: string): Promise<Dataset | null>
Parameters
PropType
namestring
The dataset name.
Type
stringReturns
Promise<Dataset | null> - The dataset with all examples hydrated, or null if the project is unresolved.
create()
Create a new dataset, optionally pre-populated with examples.
async function create(name: string, options: { examples?: Example[]; overwrite?: boolean; batchSize?: number; schema?: DatasetSchema; } = {}): Promise<Dataset | null>
Parameters
PropType
namestring
The dataset name.
Type
stringoptions?{ examples?: Example[]; overwrite?: boolean; batchSize?: number; schema?: DatasetSchema; }
Type
{ examples?: Example[]; overwrite?: boolean; batchSize?: number; schema?: DatasetSchema; }Default
{}Returns
Promise<Dataset | null> - The newly created dataset, or null if the project is unresolved.
list()
List all datasets in the project.
async function list(): Promise<PullAllOfflineDatasetsResponse | null>
Returns
Promise<PullAllOfflineDatasetsResponse | null> - An array of dataset metadata, or null if the project is unresolved.