Creates a new dataset from your logs. You can specify filters and sampling rate to select which logs to include.
Authentication
All endpoints require API key authentication:
Authorization: Bearer YOUR_API_KEY
Parameters
A description of the dataset.
The type of dataset creation. currently supports sampling.
The number of logs to sample.
The start time for filtering logs (ISO format).
The end_time time for filtering logs (ISO format).
Filters to apply to select logs for the dataset.
{
"id": {
"operator": "in",
"value": ["log_id_1", "log_id_2"]
}
}
Request Example
import requests
import json
url = "https://api.keywordsai.co/api/datasets/"
payload = json.dumps({
"name": "My Dataset",
"description": "Dataset for evaluation",
"type": "sampling",
"sampling": 50,
"start_time": "2024-01-01T00:00:00Z",
"end_time": "2024-01-31T23:59:59Z",
"initial_log_filters": {
"id": {
"operator": "in",
"value": [
"log_id_1",
"log_id_2"
]
}
}
})
headers = {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)