Analytics
The /analytics endpoint returns the analytics data for the current Project.
Run Analytics
/api/v1/analytics/runs
Method: POST
Requirements: User must have run:read permission.
Headers
| Header | Value | Description |
|---|---|---|
Authorization | Bearer <YOUR_JWT_TOKEN> | JWT token for authentication |
Content-Type | application/json | Request content type |
Input Parameters
| Parameter | Data Type | Description |
|---|---|---|
filterBy (Required) | AnalyticsAxis | Filters to apply to the query. Contains fields: environment, project, interactions, models, status, tags, selectedOnly |
groupBy | RunAnalyticsGroupBy | The field to group by. Options: "interaction", "modelId", "project", "status", "tags", "environment" |
from | number | The start date of the query in EPOCH format (milliseconds) |
to | number | The end date of the query in EPOCH format (milliseconds) |
resolution | TimeResolution | The time resolution of the analytics query. Options: "hour", "day", "week", "month", "year" |
virtual | boolean | Whether to include virtual runs in the results |
Example Request
{
"filterBy": {
"environment": "<ENVIRONMENT_ID>",
"project": "<PROJECT_ID>",
"interactions": ["<INTERACTION_ID_1>", "<INTERACTION_ID_2>"],
"models": ["gpt-4", "claude-3"],
"status": ["completed", "failed"],
"tags": ["production"],
"selectedOnly": false
},
"groupBy": "interaction",
"from": 1672531200000,
"to": 1675209600000,
"resolution": "day",
"virtual": false
}
Example Response
[
{
"date": "2023-01-15",
"timestamp": "2023-01-15T00:00:00.000Z",
"group": "<INTERACTION_ID>",
"count": 125,
"execution_time": {
"avg": 1.234,
"min": 0.456,
"max": 3.789
}
},
{
"date": "2023-01-16",
"timestamp": "2023-01-16T00:00:00.000Z",
"group": "<INTERACTION_ID>",
"count": 98,
"execution_time": {
"avg": 1.456,
"min": 0.512,
"max": 4.123
}
}
]
Code Examples
Run Analytics
curl --location --request POST 'https://api.vertesia.io/api/v1/analytics/runs' \
--header 'Authorization: Bearer <YOUR_JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"filterBy": {
"environment": "<ENVIRONMENT_ID>",
"project": "<PROJECT_ID>",
"interactions": ["<INTERACTION_ID_1>", "<INTERACTION_ID_2>"],
"models": ["gpt-4", "claude-3"],
"status": ["completed", "failed"],
"tags": ["production"],
"selectedOnly": false
},
"groupBy": "interaction",
"from": 1672531200000,
"to": 1675209600000,
"resolution": "day",
"virtual": false
}'
