Downloads a registered guard dataset (Nous.Eval.Guard.Registry), checks
it and writes it as nous.guard_case/1 JSONL. mix nous.eval.datasets.fetch is the command-line front end.
Every step fails closed:
- Resolve the source against the compiled registry (string ids;
nothing becomes an atom).
id@revis accepted for the pinned revision only. - Licence gate.
:deniedsources are refused with the reason.:termssources needaccept_terms: [id]and the acceptance is recorded in the manifest. A gated Hugging Face source needs a token (:hf_token_env); Nous cannot accept a gate for you. - Download only the registry's pinned URLs, each capped at its
registered
:max_bytes(cached by sha256 under:filename.basedir(:user_cache, "nous")/eval/downloads), and verify the sha256 before parsing: a mismatch deletes nothing of yours, keeps nothing it downloaded and is an error. - Parse CSV / JSON / JSONL natively; parquet only with the optional
:duckdbexdependency. - Adapt rows to cases with the registry's adapter (literal label tables, provenance with revision and row).
- Hygiene (
Nous.Eval.Guard.Hygiene): exact dedup (conflicting labels are an error), near-duplicate grouping, group-hash splits, the licence policy. PII findings are counted in the result (the in-repo validator is the gate for committed data). - Sample (
:sample), deterministically: per surface and label, the cases with the smallestsha256(seed <> ":" <> id), in proportion. - Write to
:out(default the cache'seval/datasets/<id>@<rev>): one JSONL file per surface, anous.guard_dataset/1manifest with file hashes, and aNOTICE.
Options: :accept_terms (list of source ids), :hf_token_env (default
"HF_TOKEN"), :cache_dir, :out, :sample, :seed (default
"nous-guard-v1"), :fractions (split shares, default
Nous.Eval.Guard.Hygiene's), :sources (the registry to resolve against,
default Nous.Eval.Guard.Registry.sources/0) and :http - (url, headers, max_bytes -> {:ok, body} | {:error, reason}), default a streaming Req
GET that aborts with {:error, {:too_large, max_bytes}} once the body
passes the file's registered :max_bytes. Only the resolved source's file
URLs are ever passed to it, and a body over max_bytes is refused before
it is hashed even if the function returns one.
Summary
Functions
The default cache root: :filename.basedir(:user_cache, "nous").
Fetches spec (see the moduledoc). Returns {:error, message} on any failure.
Types
@type result() :: %{ source: String.t(), out: Path.t(), manifest: map(), cases: non_neg_integer(), pii_findings: non_neg_integer() }