Datasets
Create a Dataset
Logging
- Overview
- POSTLogging Attributes
- Logging LLM Inferences
- Updating Logs
Evals
- Running Evals via SDK
- Loading Data for Evals
- Preset Evals
- Custom Evals
Datasets
Create a Dataset
You can create a dataset programmatically using the Python SDK.
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'
}
],
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}")