Arcana.Grounding.Result (Arcana v2.0.1)

Copy Markdown View Source

Result of grounding analysis on an LLM-generated answer.

Contains information about how well the answer is supported by the retrieved context, including a faithfulness score and any detected hallucinated or faithful spans.

Fields

  • :score - Average consistency score across sentences (0.0 to 1.0, higher is better), weighted by sentence length.
  • :hallucinated_spans - List of sentence-level span maps identifying unsupported parts of the answer. Each span has :text, :start, :end (byte offsets), :score (hallucination confidence), and :sources (list of %{chunk_id: term(), score: float()} sorted by overlap score desc).
  • :faithful_spans - List of sentence-level span maps identifying supported parts of the answer. Same shape as hallucinated spans.
  • :token_labels - Unused (kept for backwards compatibility). Always nil.

Summary

Types

span()

@type span() :: %{
  text: String.t(),
  start: non_neg_integer(),
  end: non_neg_integer(),
  score: float(),
  sources: [%{chunk_id: term(), score: float()}]
}

t()

@type t() :: %Arcana.Grounding.Result{
  faithful_spans: [span()],
  hallucinated_spans: [span()],
  score: float(),
  token_labels: [map()] | nil
}