List Events
List events for a specific training job. Events provide detailed information about the training process, including status changes, errors, and progress updates.
Endpoint
GET https://api.platform.knowledgator.com/trainings/{training_id}/events/
Headers
| Name | Type | Description |
|---|---|---|
KnowledgatorAPI-Key | String | Your API key |
Content-Type | String | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
training_id | String | Yes | Unique training job identifier (2-64 chars, alphanumeric with hyphens) |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
offset | Integer | No | Pagination offset (default: 0, min: 0) |
limit | Integer | No | Maximum results per page (default: 100, max: 10000) |
Response
{
"events": [
{
"id": "event-123",
"training_id": "78d379da228a4985ba19100f53245b79",
"event_type": "training_started",
"message": "Training job started successfully",
"created_at": "2024-01-15T10:31:00Z",
"metadata": {
"epoch": 1,
"step": 0
}
},
{
"id": "event-124",
"training_id": "78d379da228a4985ba19100f53245b79",
"event_type": "progress_update",
"message": "Completed epoch 1/10",
"created_at": "2024-01-15T10:45:00Z",
"metadata": {
"epoch": 1,
"loss": 0.234
}
}
],
"total": 2,
"offset": 0,
"limit": 100
}
Response Fields
events: Array of training event objectsid: Unique event identifiertraining_id: Training job ID this event belongs toevent_type: Type of event (e.g., training_started, progress_update, training_completed, error)message: Human-readable event messagecreated_at: ISO 8601 timestamp when event occurredmetadata: Optional additional event data (e.g., epoch, step, loss)
total: Total number of events for this trainingoffset: Current pagination offsetlimit: Current pagination limit
Error Codes
| Status Code | Description |
|---|---|
| 200 | OK – Request successful. |
| 400 | Bad Request – Invalid input or training doesn't exist. |
| 401 | Unauthorized – Invalid API key or email verification required. |
| 500 | Internal Server Error – Server-side issue. |
| 503 | Service Unavailable – Service temporarily unavailable. |
Example Usage
SDK Usage
💡 Dedicated SDK Guides: See Python SDK | TypeScript SDK
TypeScript/JavaScript
import { createClient } from '@knowledgator/typescript-sdk';
const kg = createClient('YOUR_API_KEY');
// List all events for a training job
const result = await kg.finetuning.listEvents('78d379da228a4985ba19100f53245b79');
console.log(`Total events: ${result.total}`);
result.events.forEach(event => {
console.log(`[${event.created_at}] ${event.event_type}: ${event.message}`);
if (event.metadata) {
console.log(` Metadata:`, event.metadata);
}
});
// List recent events with pagination
const recent = await kg.finetuning.listEvents('78d379da228a4985ba19100f53245b79', {
offset: 0,
limit: 10
});
console.log(recent.events);
Python
from knowledgator import Knowledgator
kg = Knowledgator(api_key="YOUR_API_KEY")
# List all events for a training job
result = kg.finetuning.list_events("78d379da228a4985ba19100f53245b79")
print(f"Total events: {result.total}")
for event in result.events:
print(f"[{event.created_at}] {event.event_type}: {event.message}")
if event.metadata:
print(f" Metadata: {event.metadata}")
# List recent events with pagination
recent = kg.finetuning.list_events(
"78d379da228a4985ba19100f53245b79",
offset=0,
limit=10
)
print(recent.events)
Expected SDK Output
Total events: 2
[2024-01-15T10:31:00Z] training_started: Training job started successfully
Metadata: {'epoch': 1, 'step': 0}
[2024-01-15T10:45:00Z] progress_update: Completed epoch 1/10
Metadata: {'epoch': 1, 'loss': 0.234}
Python
import requests
url = "https://api.platform.knowledgator.com/trainings/78d379da228a4985ba19100f53245b79/events/"
headers = {
"KnowledgatorAPI-Key": "YOUR_API_KEY"
}
# List all events
response = requests.get(url, headers=headers)
print(response.json())
# List recent events with pagination
params = {
"offset": 0,
"limit": 10
}
response = requests.get(url, headers=headers, params=params)
print(response.json())
cURL
# List all events
curl -X GET "https://api.platform.knowledgator.com/trainings/78d379da228a4985ba19100f53245b79/events/" \
-H "KnowledgatorAPI-Key: YOUR_API_KEY"
# List recent events with pagination
curl -X GET "https://api.platform.knowledgator.com/trainings/78d379da228a4985ba19100f53245b79/events/?offset=0&limit=10" \
-H "KnowledgatorAPI-Key: YOUR_API_KEY"
Expected Response (cURL)
{
"events": [
{
"id": "event-123",
"training_id": "78d379da228a4985ba19100f53245b79",
"event_type": "training_started",
"message": "Training job started successfully",
"created_at": "2024-01-15T10:31:00Z",
"metadata": {
"epoch": 1,
"step": 0
}
},
{
"id": "event-124",
"training_id": "78d379da228a4985ba19100f53245b79",
"event_type": "progress_update",
"message": "Completed epoch 1/10",
"created_at": "2024-01-15T10:45:00Z",
"metadata": {
"epoch": 1,
"loss": 0.234
}
}
],
"total": 2,
"offset": 0,
"limit": 10
}
Additional Information
- Event Types: Common event types include training_started, progress_update, training_completed, training_failed, error
- Metadata: Event metadata varies by event type and may include epoch, step, loss, and other training metrics
- Pagination: Use offset and limit to retrieve events in batches
- Use Cases:
- Monitor training progress in real-time
- Debug failed trainings by examining error events
- Track training milestones and checkpoints
- Build training dashboards and visualizations