Nous.Eval.Online.Review (nous v0.21.1)

Copy Markdown View Source

The review queue of promoted guard cases: a nous.guard_case/1 JSONL file whose unlabelled lines ("label": null) wait for a human.

Nous.Eval.promote/3 with as: {:guard_case, surface: ...} appends lines with label: null and provenance.review: "pending"; a dataset validator leaves them out of calibration. pending/1 lists them in review order, label/5 records a human decision:

{:ok, [first | _]} = Nous.Eval.Online.Review.pending("guards/online.jsonl")
:ok = Nous.Eval.Online.Review.label("guards/online.jsonl", first["id"], "block", "alice")

The file is the queue (one reviewer per file); every write replaces it through a temporary file and a rename. mix nous.eval.promote --label does the same from the command line.

Summary

Functions

Labels the case id of path with label ("block" or "allow"): sets provenance.label_source: "promoted_reviewed", provenance.review: "approved" and provenance.reviewed: {"by": reviewer, "at": iso8601}.

The unlabelled cases of path, decoded, escalated and denied ones first (by the guard's observed verdict), then in file order.

Functions

label(path, id, label, reviewer, opts \\ [])

@spec label(Path.t(), String.t(), String.t(), String.t(), keyword()) ::
  :ok | {:error, term()}

Labels the case id of path with label ("block" or "allow"): sets provenance.label_source: "promoted_reviewed", provenance.review: "approved" and provenance.reviewed: {"by": reviewer, "at": iso8601}.

Options: :at - the review time (default now).

Errors: {:error, :not_found}, {:error, {:invalid_label, label}}, {:error, :invalid_reviewer}.

pending(path)

@spec pending(Path.t()) :: {:ok, [map()]} | {:error, term()}

The unlabelled cases of path, decoded, escalated and denied ones first (by the guard's observed verdict), then in file order.