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

# Create a Custom Dataset

> Learn how to create and upload custom datasets using the SDK

> [!WARNING]
>
> You are reading the docs of Galtea 5.16. [Read this page in the latest version](https://docs.galtea.ai/sdk/tutorials/create-dataset.md).

> [!NOTE]
>
> **Looking for the fastest way to create datasets?** If you've defined [Specifications](https://docs.galtea.ai/v5.16/concepts/product/specification.md), Galtea can [generate datasets automatically](https://docs.galtea.ai/v5.16/sdk/tutorials/specification-driven-evaluations.md#step-3-create-datasets-from-specifications) — including type, variants, and test cases. Use this tutorial when you need full control over dataset creation or want to upload your own test data.

You can create [Datasets](https://docs.galtea.ai/v5.16/concepts/product/dataset.md) by uploading your own test data or by having Galtea generate test cases from a knowledge file.

## Creating Datasets with the SDK

The Galtea SDK provides methods to create [Accuracy Datasets](https://docs.galtea.ai/v5.16/concepts/product/dataset/accuracy-datasets.md), [Security & Safety Datasets](https://docs.galtea.ai/v5.16/concepts/product/dataset/security-datasets.md), and [Behavior Datasets](https://docs.galtea.ai/v5.16/concepts/product/dataset/behavior-datasets.md).

> [tab] Upload Existing Dataset File
>
> If you have a prepared dataset file in CSV format, you can upload it directly.
>
> ```python theme={"system"}
> # Upload a pre-existing dataset file to the Galtea Platform
> dataset = galtea.datasets.create(
>     name="financial-qa-test-" + run_identifier,
>     type="ACCURACY",
>     product_id=product_id,
>     dataset_file_path="path/to/accuracy_dataset.csv",
> )
> ```
>
> > [!WARNING]
> >
> > The dataset file must follow the structure specified for:
> >
> > * [Accuracy Datasets](https://docs.galtea.ai/v5.16/concepts/product/dataset/accuracy-datasets.md#example-accuracy-datasets-and-file-format): Standard format with `input`, `expected_output`, etc.
> > * [Security & Safety Datasets](https://docs.galtea.ai/v5.16/concepts/product/dataset/security-datasets.md#example-security--safety-datasets-and-file-format): Standard format with adversarial inputs
> > * [Behavior Datasets](https://docs.galtea.ai/v5.16/sdk/tutorials/simulating-conversations.md): Conversation simulator format with `goal`, `user_persona`, etc.
> >
> > If the file is not correctly formatted, test cases will not be created automatically, but you can still [add them manually](https://docs.galtea.ai/v5.16/sdk/api/test-case/create.md).
>
> > [!NOTE]
> >
> > **Behavior Datasets**: Use `type="BEHAVIOR"` to create conversation simulation datasets that enable multi-turn dialogue evaluation with simulated users. See the [Conversation Simulator Tutorial](https://docs.galtea.ai/v5.16/sdk/tutorials/simulating-conversations.md) for complete examples.

> [tab] Generate Dataset from Knowledge Base
>
> You can provide a knowledge base file (e.g., PDF, TXT) and have Galtea generate the test cases for you. This is a powerful feature for creating comprehensive datasets with minimal effort.
>
> ```python theme={"system"}
> # Generate a dataset from a knowledge base file (PDF, TXT, etc.)
> generated_dataset = galtea.datasets.create(
>     name="generated-financial-qa-test-" + run_identifier,
>     type="ACCURACY",
>     product_id=product_id,
>     ground_truth_file_path="path/to/knowledge.md",
>     language="english",
>     max_test_cases=50,  # Limit the number of generated test cases
> )
> ```

## Next Steps

> [card] [Run Dataset-Based Evaluations](https://docs.galtea.ai/v5.16/sdk/tutorials/run-dataset-based-evaluations.md)
>
> Run your dataset against a specific product version.

> [card] [API Reference](https://docs.galtea.ai/v5.16/sdk/api/dataset/service.md)
>
> View the complete Dataset Service API reference.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.