> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getbasalt.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Datasets

> Working with datasets in Basalt

## What are Datasets?

Datasets in Basalt provide a structured way to store, manage, and utilize collections of data for your AI workflows. With datasets, you can:

* Store representative examples of your inputs and expected outputs
* Create standardized test sets for evaluating your AI systems
* Run experiments against consistent data
* Compare different approaches using the same baseline data

## Working with Datasets

The Basalt SDK provides three main operations for working with datasets:

### List All Datasets

Retrieve a list of all datasets available in your workspace:

```typescript theme={null}
const result = await basalt.datasets.list();
if (result.error) {
  console.error('Error listing datasets:', result.error);
  return;
}

const datasets = result.value;
console.log('Available datasets:', datasets);
```

### Get a Specific Dataset

Retrieve a single dataset by its slug, including all rows/items:

```typescript theme={null}
const result = await basalt.datasets.get('customer-queries');
if (result.error) {
  console.error('Error getting dataset:', result.error);
  return;
}

const dataset = result.value;
console.log('Dataset details:', {
  name: dataset.name,
  slug: dataset.slug,
  columns: dataset.columns,
  rowCount: dataset.rows?.length
});

// Access dataset rows
dataset.rows?.forEach(row => {
  console.log('Row values:', row.values);
});
```

### Add a Row to a Dataset

Add a new row/item to an existing dataset:

```typescript theme={null}
const result = await basalt.datasets.addRow('customer-queries', {
  values: {
    input: 'How do I track my recent order?',
    category: 'orders'
  },
  idealOutput: 'order_tracking',
  metadata: {
    source: 'customer_support',
    priority: 'high'
  }
});

if (result.error) {
  console.error('Error adding row:', result.error);
  return;
}

console.log('Added row:', result.value);
```

## Benefits of Datasets

Basalt Datasets help you:

* **Ensure Consistency**: Test on the same data over time
* **Improve Reproducibility**: Get reliable comparisons between different approaches
* **Streamline Testing**: Automate experimentation with real-world examples
* **Track Progress**: Measure improvements against a consistent benchmark
* **Organize Examples**: Keep your test cases and training examples structured and accessible
