Evidence available to an evaluation metric.
The context keeps metric implementations independent from Ecto schemas while providing enough information for deterministic checks, model-based judges, and application-defined evaluators. Optional fields use JSON-compatible values so results can be reproduced and reported consistently.
Existing metrics that only need generated text may continue to accept a
string. Use new/2 when a metric needs prompt, provider, document, or
execution evidence.
Summary
Functions
Creates a metric context for generated output and optional evidence.
Types
@type json_value() :: nil | boolean() | number() | String.t() | [json_value()] | %{optional(String.t()) => json_value()}
@type t() :: %Aludel.Evals.Metric.Context{ documents: [map()], execution: map(), expected: json_value(), messages: [map()], metadata: map(), output: String.t(), prompt_template: String.t() | nil, prompt_version: map() | nil, provider: map() | nil, rendered_input: String.t() | nil, variables: map() }