> For the complete documentation index, see [llms.txt](https://docs.scorable.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scorable.ai/concepts-and-examples/usage/datasets-and-annotations/dataset-import.md).

# Import and Export

Bring data into Scorable for calibration, demonstrations, Batch Evaluation and Prompt Testing, and download it again.

Every dataset in Scorable is the same kind of object: a list of items, each holding a request and response or a conversation, optionally with contexts, an expected output, variables, and labels. What a dataset is *for* decides which of those fields matter. One dataset can serve several uses: a labeled calibration set, for example, can also be run as a Batch Evaluation.

## Dataset uses at a glance

| Use                          | Labels                                     | Fields that matter                                                                                               | Where to import                                                                                                                                                                           | Learn more                                                                                                                                                                                                                                               |
| ---------------------------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Calibration**              | Required, for the evaluator's score config | `label`, `response`, optionally `request`                                                                        | The evaluator's calibration editor, or **Datasets → Import**                                                                                                                              | [Calibration runs](https://docs.scorable.ai/concepts-and-examples/usage/datasets-and-annotations.md#calibration-runs), [Add a calibration set](https://docs.scorable.ai/concepts-and-examples/cookbooks/add-a-custom-evaluator/add-a-calibration-set.md) |
| **Demonstrations**           | Required, for the evaluator's score config | `label`, `response`, optionally `request` and `justification`, which the evaluator reads to learn your reasoning | The evaluator's demonstrations editor, or **Datasets → Import**                                                                                                                           | [Add a custom evaluator](https://docs.scorable.ai/concepts-and-examples/cookbooks/add-a-custom-evaluator.md)                                                                                                                                             |
| **Batch Evaluation**         | Not used                                   | `request` and `response`, or `turns`; `contexts` and `expected_output` when an evaluator needs them              | The Batch Evaluation dataset editor, or **Datasets → Import**                                                                                                                             | [Batch Evaluation](https://docs.scorable.ai/concepts-and-examples/usage/batch-evaluation.md)                                                                                                                                                             |
| **Prompt Testing**           | Not used                                   | Variables, matched to the prompt's `{{variables}}` by column name; `request`, `response`, `expected_output`      | **Datasets → Import**, with a header row                                                                                                                                                  | [Prompt Testing](https://docs.scorable.ai/concepts-and-examples/usage/prompt-testing.md#using-a-dataset)                                                                                                                                                 |
| **Multi-turn conversations** | Optional                                   | `turns`, a JSON list of role/content messages, or alternating request and response columns                       | The Batch Evaluation editor with **Conversation (multi-turn)** ticked, for either format, or **Datasets → Import** with a `turns` column. Not supported in calibration or demonstrations. | [Batch Evaluation](https://docs.scorable.ai/concepts-and-examples/usage/batch-evaluation.md#csv-import)                                                                                                                                                  |

A one-row example for each, with a header row:

```csv
label,response,request
0.2,"This solution will probably work for most users.","Will this fix my problem?"
```

```csv
label,response,justification
0.0,"It will probably arrive on Tuesday.","Uses the hedging word 'probably'."
```

```csv
request,response
"Can I return this?","Yes, within 30 days."
```

```csv
text,expected_output
"The analytics reports look great.","positive"
```

```csv
turns
"[{""role"": ""user"", ""content"": ""Can I return this?""}, {""role"": ""assistant"", ""content"": ""Yes, within 30 days.""}]"
```

The same conversation as alternating columns, for the Batch Evaluation editor with **Conversation (multi-turn)** ticked:

```csv
question,answer,question,answer
"Can I return this?","Yes, within 30 days.","Do I need a receipt?","Yes, please include it."
```

## Ways to bring data in

* **CSV upload**, in the UI. See below for the column formats.
* **Production samples**: add real runs from the [execution logs](https://scorable.ai/monitoring/executions) to a dataset with one click.
* **Ladder generation**: synthesize examples that span the full 0.0 to 1.0 score range from your scoring criteria. See [Add a calibration set](https://docs.scorable.ai/concepts-and-examples/cookbooks/add-a-custom-evaluator/add-a-calibration-set.md).
* **Typing rows** into the calibration, demonstration, or Batch Evaluation editor.
* **SDK, CLI, and API**: create a dataset, add items, and annotate them. See the example in [Calibration runs](https://docs.scorable.ai/concepts-and-examples/usage/datasets-and-annotations.md#calibration-runs) and the [CLI guide](https://docs.scorable.ai/concepts-and-examples/cookbooks/cli.md). A CSV can also be uploaded through the API; see [When a first row counts as a header](#when-a-first-row-counts-as-a-header).

## CSV upload

You can upload a CSV in four places:

* **Datasets → Import**: creates a new dataset from the file, including its labels.
* **Batch Evaluation**: the **Upload CSV** button in the dataset editor.
* **Demonstrations** and **calibration**: the **Upload CSV** button in the evaluator's dataset editor.

When importing into **Batch Evaluation**, **demonstrations**, or **calibration**, choose the delimiter that matches your file: **comma**, **semicolon**, or **tab**. On **Datasets → Import**, the **Delimiter** selector offers comma or semicolon and is preselected from the file; you can change it before uploading.

Each row is one dataset item. If a row has a problem, nothing from the file is imported, and the error names the row or column.

### Use a header row

A header row is the recommended format. Columns are matched by name, so their order does not matter, and every field, label, and variable can be imported. A [downloaded dataset](#download-and-re-import) always has a header row, so it uploads back unchanged.

A one-row example with a label and justification:

```csv
request,response,label,justification
"Can I return this?","Yes, within 30 days.",0.9,"Correct and concise."
```

Column names are matched case-insensitively, ignoring surrounding spaces:

| Column                      | Also accepted                              | Holds                                                                                                                                  |
| --------------------------- | ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| `request`                   | `input`, `question`, `prompt`, `q`         | The request                                                                                                                            |
| `response`                  | `output`, `answer`, `completion`, `a`      | The response                                                                                                                           |
| `expected_output`           | `expected output`, `expected`, `reference` | The reference answer used by ground-truth evaluators                                                                                   |
| `contexts`                  | `context`                                  | Retrieved contexts: a JSON list of strings, or plain text for a single context                                                         |
| `turns`                     |                                            | A conversation as a JSON list of `{"role": ..., "content": ...}` objects. A row cannot have both `turns` and a request or response.    |
| `label`                     |                                            | The label for the default **Score** config                                                                                             |
| `label.<score config name>` |                                            | The label for the named [score config](https://docs.scorable.ai/concepts-and-examples/usage/datasets-and-annotations.md#score-configs) |
| `justification`             | `rationale`, `reason`                      | The justification for `label`. Use `justification.<score config name>` for a named config's label.                                     |
| Any other name              |                                            | A variable with that name                                                                                                              |
| `variables.<name>`          |                                            | A variable, even when `<name>` is one of the names above, for example `variables.request`                                              |

A conversation item in a header-based file, using `turns`:

```csv
turns,label
"[{""role"": ""user"", ""content"": ""Can I return this?""}, {""role"": ""assistant"", ""content"": ""Yes, within 30 days.""}]",0.9
```

The import is rejected when:

* two columns map to the same field or label, for example `request` and `question`;
* a justification column has no matching label column;
* a label does not fit its score config, or `label.<name>` names a score config that does not exist or matches more than one config.

On **Datasets → Import**, a column with no name and no values, such as the one a delimiter at the end of every line creates, is ignored. A column with no name that does hold values is rejected.

#### When a first row counts as a header

A first row is treated as a header when it names at least one column from the table above and contains no numbers. A data row usually holds a numeric label, so it is not mistaken for a header. The one-letter names `q` and `a` do not count on their own.

* **Datasets → Import** pre-ticks **First row is a header** when it detects one. Untick it if your first row is data.
* The **Batch Evaluation**, **demonstration**, and **calibration** editors detect the header themselves.
* The API does not detect a header: `has_header` defaults to `false`. Pass `has_header=true` for a file with a header row.

```bash
curl -X POST "https://api.scorable.ai/v1/datasets/" \
  -H "Authorization: Api-Key ${SCORABLE_API_KEY}" \
  -F "name=Support questions" \
  -F "file=@support.csv" \
  -F "has_header=true" \
  -F "delimiter=;"
```

`delimiter` is optional and accepts `,` (the default) or `;`.

### What each upload reads

| Upload                                 | With a header                                                                                                | Labels                                                                                                                                                                            |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Datasets → Import**                  | Every column in the table above                                                                              | Saved as published annotations                                                                                                                                                    |
| **Batch Evaluation**                   | `request`, `response`, `turns`, `expected_output`, `contexts`, and variables                                 | Label and justification columns are ignored: a batch run does not compare scores to labels                                                                                        |
| **Demonstrations** and **calibration** | `label`, `response`, and optionally `request`, `justification`, `expected_output`, `contexts`, and variables | Required on every row, for the editor's score config: `label.<score config name>`, or plain `label` when the editor uses the default Score config. `turns` is not supported here. |

### Files without a header row

A file without a header row is read by column position. Where it goes determines the order.

**Datasets → Import** reads `request, response, expected_output`. A file with one column is read as responses. A fourth column and any after it become variables named `column_4`, `column_5`, and so on. Labels cannot be imported without a header.

```csv
"Can I return this?","Yes, within 30 days."
```

**Batch Evaluation** reads `request, response`. Columns after the second are ignored.

```csv
"Can I return this?","Yes, within 30 days."
```

To import conversations, tick **Conversation (multi-turn)** in the Batch Evaluation editor before uploading. Each row is then read as alternating `request, response, request, response, ...` columns, forming one conversation in order. A row needs an even number of non-empty cells with no gaps between them. Empty cells at the end of a row are ignored. Conversation mode applies to a file with a header too, unless it has a `turns` column. A one-row conversation with two exchanges:

```csv
"Can I return this?","Yes, within 30 days.","Do I need a receipt?","Yes, please include it."
```

The same file can start with a header row, such as `question,answer,question,answer` or `request,response,request,response`:

```csv
question,answer,question,answer
"Can I return this?","Yes, within 30 days.","Do I need a receipt?","Yes, please include it."
```

This only works in the Batch Evaluation editor with **Conversation (multi-turn)** ticked. Without it, and always on **Datasets → Import**, such a header is rejected, because the repeated columns all map to the same request and response fields. To import conversations on **Datasets → Import**, use a [`turns` column](#use-a-header-row).

**Demonstrations** and **calibration** read `label, response, request (optional)`:

```csv
0.2,"This solution will probably work for most users.","Will this fix my problem?"
```

### Labels and numbers

**Label** means the expected **score**, **pass/fail value**, or **category**, as defined by the applicable [score config](https://docs.scorable.ai/concepts-and-examples/usage/datasets-and-annotations.md#score-configs). It is an annotation on the item. It is separate from `expected_output`, which is a reference answer used by ground-truth evaluators. Demonstrations and calibration require labels. Batch Evaluation does not use them.

For a numeric score, write the number with a decimal point, for example `0.2`. The demonstration and calibration editors also accept a decimal comma (`0,2`), which must be quoted in a comma-separated file. **Datasets → Import** and the API require a decimal point. For a pass/fail or categorical config, write the category name as defined in the score config, or its numeric value.

### Quoting

Enclose a field in double quotes if it contains the delimiter, a double quote, or a line break. Escape a double quote inside a quoted field by doubling it. Quoting every field is also valid. For example, with a comma delimiter:

```csv
0.9,"They said ""hello"", then left.","What happened?"
```

### Named columns for prompt testing

For a dataset used in prompt testing, include a header row so custom variables have names. Columns named `request`, `response`, and `expected_output`, or one of their alternative names above, map onto those item fields. Other columns become named variables. A column that must stay a variable despite a reserved name can be written as `variables.request`.

```csv
text,expected_output
"The analytics reports look great.","positive"
```

See [Prompt Testing](https://docs.scorable.ai/concepts-and-examples/usage/prompt-testing.md#using-a-dataset) for variable matching and missing-variable errors.

## Download and re-import

Download a dataset from the **Datasets** list with the download icon. The file is comma-separated, starts with a header row, and contains:

* the `turns`, `request`, `response`, `expected_output`, and `contexts` columns that hold data in at least one item;
* for each score config with labels, a `label` or `label.<score config name>` column with the newest published label, plus a `justification` column when any label has one;
* one column per variable. A variable named like another column is written as `variables.<name>`.

A cell that a spreadsheet would run as a formula, one starting with `=`, `+`, `-`, or `@` that is not a plain number, gets a leading `'` so the file is safe to open. An import of a file with a header row removes that quote again.

Upload the file unchanged on **Datasets → Import** to copy a dataset with its labels, or into the Batch Evaluation, demonstration, or calibration editor.
