Privacy-safe summary of one router-only evaluation.
A receipt records the selected route, sanitized provider-call outcomes and durations, and whether an LLM adapter was actually invoked. It deliberately excludes input text, prompts, model output, candidate matches, and handlers so evaluation artifacts can be shared without silently becoming conversation logs.
Summary
Functions
Builds a receipt from a completed routing context.
Builds an error receipt when the router pipeline cannot complete.
Types
@type candidate_summary() :: %{ :provider => atom(), :label => atom() | nil, :accepted? => boolean(), :score => number() | nil, :margin => number() | nil, :strength => atom(), optional(:eligible?) => boolean(), optional(:winner?) => boolean(), optional(:rejection_reason) => atom() | nil, optional(:required) => map() }
@type outcome() :: :route | :clarify | :unknown | :error
@type provider_call() :: %{ :provider => atom(), :outcome => atom(), :duration_us => non_neg_integer(), :invoked? => boolean(), optional(:purpose) => atom() }
@type t() :: %Spectre.Router.Receipt{ accepted?: boolean(), arbitration: map() | nil, attempts: [attempt()], candidates: [candidate_summary()], duration_us: non_neg_integer(), error: atom() | nil, label: atom() | nil, llm_called?: boolean(), outcome: outcome(), provider_calls: [provider_call()], scope: Spectre.Definition.scope() | nil, strategy: atom() | nil, trace_codes: [atom()] }
Functions
@spec from_context(Spectre.Router.Context.t(), non_neg_integer()) :: t()
Builds a receipt from a completed routing context.
@spec from_error(term(), non_neg_integer()) :: t()
Builds an error receipt when the router pipeline cannot complete.