mistralM

Docs

Set how values display

Use Display on an evaluator to show its scores and statistics in Studio as percents, integers, or numbers with a unit.

Studio shows numeric values as plain decimals by default: a 63% accuracy reads 0.6341, a 0/1 check reads 0 or 1, and a latency reads 1.7210. Set display on an evaluator to choose how its values read in Studio.

from mistralai.evaluations import Display, Evaluator, RunEvaluator

Evaluator(
    name="field_accuracy",
    scorer=field_accuracy_scorer,
    display=Display(format="percent"),  # 0.6341 reads 63.4%
)

RunEvaluator(
    name="llm_latency_p50",
    scorer=latency_p50,
    display=Display(format="number", unit="s", decimals=2),  # 1.721 reads 1.72 s
)

display only changes how values read. The stored scores, the statistics, the goals, and the optimizer objective all keep the raw values: a percent evaluator still targets Goal.gte(0.8), which reads ≥ 80.0%.

flag

display requires SDK 0.11.0+. It's optional, so existing evaluators need no change.

Fields

Field

Type

Description

format"number" | "percent" | "integer" | None"percent" reads the value as a fraction (0.6341 reads 63.4%). "integer" rounds it (41.6 reads 42). "number" shows a decimal number. None keeps the default rendering.
unitstr | NoneA suffix after the value, such as "s", "ms", or "chars" (1 to 20 characters). Not allowed with "percent", whose % is already the unit.
decimalsint | NoneThe number of decimals, from 0 to 10, for "number" and "percent". Percent defaults to 1. Without a format, it has no effect: write Display(format="number", decimals=2).
metricstr | NoneRunEvaluator only: the score metric this format applies to. See Run evaluator metrics.

What it applies to

The format applies to every value on the score's scale: the scores, their statistics (avg, min, max, percentiles, std, sum), the goal thresholds, and the values a goal got.

It never applies to counts (count, the number of samples), which aren't on the score's scale. The sum of a percent evaluator is a count too (the sum of 0/1 checks is the number of passes), so it reads as a plain number.

Non-numeric scores (strings, booleans, JSON) keep their rendering. A score in [0, 1] isn't read as a percent on its own: set format="percent" to say so.

Run evaluator metrics

A RunEvaluator score can return metrics next to its value. Like goal, its display takes one Display or a list, and metric= picks the number:

  • A Display without metric formats the value and is the default format of every metric.
  • A Display with metric="name" replaces it for that metric.
RunEvaluator(
    name="extraction_cells",
    scorer=cells_accuracy,
    display=[
        Display(format="percent"),                    # 86.7%, and the default for the metrics
        Display(metric="correct", format="integer"),  # 412, not 41200%
        Display(metric="total", format="integer"),
    ],
)

Without a format per metric, a percent accuracy would show its counts as percents too (412 would read 41200%). Declare the value's format, then a Display(metric=...) for each metric of another kind, such as a count next to a rate or seconds next to a percent.

Situation

Result

No displayThe value and the metrics keep the default rendering
A Display without metric onlyThe same format for the value and every metric
Display(metric="tp", ...)That format for tp, the default format for the others
Two Display for the same target (two without metric, or two with the same metric)ValueError when building the RunEvaluator
Display(metric="name") and the metric missing from a scoreNo error: a metric may only show up in some runs
Display(metric=...) on a per-record EvaluatorValueError: per-record evaluators have no metrics

Rescoring

display is part of the evaluator's definition: rescoring a run with an evaluator replaces its display along with the rest of its definition.

No. Goals compare raw values. Write Goal.gte(0.8) for an 80% target: Studio shows the threshold as ≥ 80.0%.

Yes, from plugin 0.9.0. Import Display from mistralai.evaluations and pass it on the evaluator as in the SDK.