Import the required classes and initialize Athina API key.

import os
from athina_client.datasets import Dataset
from athina_client.keys import AthinaApiKey

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

Now you can create a dataset.

# Create a dataset
try:
    dataset = Dataset.create(
        name='test_dataset',
        # All fields below are optional
        description='This is a test dataset',
        language_model_id='gpt-4o',
        rows=[
            {
                'query': 'What is the capital of Greece?',
                'context': ['Greece is a country in southeastern Europe.', 'Athens is the capital of Greece.'],
                'response': 'Athens',
                'expected_response': 'Athens'
            }
        ]
    )
except Exception as e:
    print(f"Failed to create dataset: {e}")