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

pip install athina-client

2. Set your API keys

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

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

from athina_client.datasets import Dataset

try:
  dataset = Dataset.create(
    name='test_dataset',
    description="Optional description", # optional
    language_model_id="gpt-4", # optional
  )
except Exception as e:
  print(f"Failed to create dataset: {e}")

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

4. Add rows to the dataset

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}")

You can also find the dataset_id from the URL when you open the dataset through https://app.athina.ai/develop.

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