> ## 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

<Note>
  **Looking for the fastest way to create datasets?** If you've defined [Specifications](/concepts/product/specification), Galtea can [generate datasets automatically](/sdk/tutorials/specification-driven-evaluations#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.
</Note>

You can create [Datasets](/concepts/product/dataset) 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](/concepts/product/dataset/accuracy-datasets), [Security & Safety Datasets](/concepts/product/dataset/security-datasets), and [Behavior Datasets](/concepts/product/dataset/behavior-datasets).

<Tabs>
  <Tab title="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](/concepts/product/dataset/accuracy-datasets#example-accuracy-datasets-and-file-format): Standard format with `input`, `expected_output`, etc.
      * [Security & Safety Datasets](/concepts/product/dataset/security-datasets#example-security--safety-datasets-and-file-format): Standard format with adversarial inputs
      * [Behavior Datasets](/sdk/tutorials/simulating-conversations): 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](/sdk/api/test-case/create).
    </Warning>

    <Info>
      **Behavior Datasets**: Use `type="BEHAVIOR"` to create conversation simulation datasets that enable multi-turn dialogue evaluation with simulated users. See the [Conversation Simulator Tutorial](/sdk/tutorials/simulating-conversations) for complete examples.
    </Info>
  </Tab>

  <Tab title="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
    )
    ```
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="Run Dataset-Based Evaluations" icon="badge-check" href="/sdk/tutorials/run-dataset-based-evaluations">
    Run your dataset against a specific product version.
  </Card>

  <Card title="API Reference" icon="code" href="/sdk/api/dataset/service">
    View the complete Dataset Service API reference.
  </Card>
</CardGroup>
