---
title: DatasetFactory
seo:
  title: DatasetFactory — TypeScript SDK
  description: Creates, retrieves, and lists datasets in your project. (TypeScript SDK)
description: Creates, retrieves, and lists datasets in your project.
---

Access via `client.datasets`.

```typescript
const datasets = await client.datasets.list();
const dataset = await client.datasets.get("golden-set");
```

## get()

Retrieve a dataset by name, including all its examples.

```typescript
async function get(name: string): Promise<Dataset | null>
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `name` | `string` | - | The dataset name. |

### Returns

`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.

```typescript
async function create(name: string, options: { examples?: Example[]; overwrite?: boolean; batchSize?: number; schema?: DatasetSchema; } = {}): Promise<Dataset | null>
```

### Parameters

| Prop | Type | Default | Description |
| - | - | - | - |
| `name` | `string` | - | The dataset name. |
| `options?` | `{ examples?: Example[]; overwrite?: boolean; batchSize?: number; schema?: DatasetSchema; }` | `{}` | |

### Returns

`Promise<Dataset | null>` - The newly created dataset, or `null` if the project is unresolved.

***

## list()

List all datasets in the project.

```typescript
async function list(): Promise<PullAllOfflineDatasetsResponse | null>
```

### Returns

`Promise<PullAllOfflineDatasetsResponse | null>` - An array of dataset metadata, or `null` if the project is unresolved.
