Returns the reduction metric for filtered values (base + derived) for one or more keys from a project.
This endpoint supports three modes of operation:
-
Single key, no grouping: Returns a single metric value
Example:
GET /logs/metric/mean?key=score
Response:
-
Multiple keys, no grouping: Returns a dict mapping keys to metric values
Example:
GET /logs/metric/mean?key=["score","length"]
Response:
{"score": 4.56, "length": 120}
-
With grouping: Returns metrics grouped by one or more fields
Example:
GET /logs/metric/mean with body {"key": "score", "group_by": "model"}
Response:
{"gpt-4": 4.56, "gpt-3.5": 3.78}
For nested grouping, provide a list of fields:
Example:
GET /logs/metric/mean with body {"key": "score", "group_by": ["model", "temperature"]}
Response:
{"gpt-4": {"0.7": 4.56, "0.9": 4.23}, "gpt-3.5": {"0.7": 3.78, "0.9": 3.45}}
The group_by parameter can be a string for single-level grouping or a list of strings for
nested grouping. Each group_by field can be prefixed with “params/” to indicate it’s a parameter.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
Body
Single key string or a list of keys.
Optional per-key metrics mapping. If provided, overrides the path metric for those keys.
Expression to filter logs (string or key->expr dict).
Log IDs to include (string or key->IDs dict).
Log IDs to exclude (string or key->IDs dict).
Field(s) to group by when computing metrics. Can be a single field name or a list of field names for nested grouping.
curl --request GET \
--url 'https://api.unify.ai/v0/logs/metric/<default_metric>?project=None' \
--header "Authorization: Bearer $UNIFY_KEY"
--header 'Content-Type: application/json' \
--data '{}'