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

# Via Python SDK

> You can use our Python SDK to create a dataset in Athina.

You can create a dataset and add rows programmatically using our Python SDK.

If you are using any other language, then you can do so through some simple API requests.

## Create Dataset via SDK

**1. Install the `athina` package**

```python
pip install athina-client
```

**2. Set your API keys**

If you are using the python SDK, then can set the API keys like this:

```python
import os
from athina_client.keys import AthinaApiKey

AthinaApiKey.set_key(os.getenv('ATHINA_API_KEY'))
```

**3. Create a dataset and log it to athina**

```python
from athina_client.datasets import Dataset

try:
  dataset = Dataset.create(
    name='test_dataset',
    # the fields below are optional
    description="Optional description",
    tags=["tag1", "tag2"],
    project_name="project_name", # Note: project name should already exist on Athina
    metadata={
          # freeform dictionary of metadata
          'model': 'gpt-4o-mini',
          'prompt': 'closed_qa/v1',
          'dataset_type': 'classification',
          'dataset_source': 'https://example.com',
      }
  )
except Exception as e:
  print(f"Failed to create dataset: {e}")
```

<Tip>
  The name of the dataset must be unique, otherwise the request will throw an
  exception.
</Tip>

**4. Add rows to the dataset**

```python
try:
  Dataset.add_rows(
      dataset_id=dataset.id,
      rows=[
          {
              'query': 'What is the capital of France?',
              'context': ['France is a country in Western Europe.', 'Paris is the capital of France.'],
              'response': 'Paris',
              'expected_response': 'Paris'
          },
      ],
  )
except Exception as e:
    print(f"Failed to add rows: {e}")
```

<Tip>
  You can also find the `dataset_id` from the URL when you open the dataset
  through [https://app.athina.ai/develop](https://app.athina.ai/develop).
</Tip>

<Tip>
  Currently, a dataset can have a maximum of 10000 rows. If the number of rows >
  10000, the API will return an exception with status code 400.
</Tip>
