v1

latestOpenAPI 3.1.02026-07-13154170539.0 KB
Logs

Get Logs Metric

Returns the reduction metric for filtered values (base + derived) for one or more keys from a project.

This endpoint supports three modes of operation:

  1. Single key, no grouping: Returns a single metric value Example:

    GET /logs/metric/mean?key=score
    

    Response:

    4.56
    
  2. 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}
    
  3. 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.

get/v0/logs/metric/{default_metric}

Path parameters

default_metricstring required

Query parameters

project_namestring required

Request body

metricsobject nullable

Optional per-key metrics mapping. If provided, overrides the path metric for those keys.

contextstring nullable

Context name (string).

Response

Successful Response

object required
OR
number required
OR
integer required
OR
boolean required
OR
string required