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

HeaderValueDescription
AuthorizationBearer <YOUR_JWT_TOKEN>JWT token for authentication
Content-Typeapplication/jsonRequest content type

Input Parameters

ParameterData TypeDescription
filterBy (Required)AnalyticsAxisFilters to apply to the query. Contains fields: environment, project, interactions, models, status, tags, selectedOnly
groupByRunAnalyticsGroupByThe field to group by. Options: "interaction", "modelId", "project", "status", "tags", "environment"
fromnumberThe start date of the query in EPOCH format (milliseconds)
tonumberThe end date of the query in EPOCH format (milliseconds)
resolutionTimeResolutionThe time resolution of the analytics query. Options: "hour", "day", "week", "month", "year"
virtualbooleanWhether 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
}'

Was this page helpful?