citeformer.verify.verifier

Top-level verification orchestrator.

Composes the three checks (existence, entailment, coverage) into one VerificationReport. Users typically reach this via GenerationResult.verify(sources=...) rather than constructing Verifier directly, but the class is public so advanced users can plug in a custom NLIModel or skip the NLI paths entirely.

Module Contents

Classes

Verifier

Runs the three verification checks against a GenerationResult.

API

class citeformer.verify.verifier.Verifier(*, threshold: float = 0.5, nli: citeformer.verify.nli.NLIModel | None = None)

Runs the three verification checks against a GenerationResult.

Attributes: threshold: Entailment probability above which a citation is supported and an uncited sentence is flagged. nli: The NLI backend. If None, a default NLIModel is created lazily on first verify() call.

Initialization

Construct a Verifier.

Args: threshold: Entailment cutoff for supported / flagging. nli: Preconstructed NLI model, or None to build a default on first use.

threshold: float

None

nli: citeformer.verify.nli.NLIModel | None

None

verify(text: str, citations: list[citeformer.core.Citation], sources: list[citeformer.core.Source], *, run_coverage: bool = True, **_options: Any) citeformer.verify.report.VerificationReport

Run the full verification pipeline.

Args: text: The generated text (GenerationResult.text). citations: Citations emitted in generation. sources: Sources that were in scope. run_coverage: If False, skip the NLI coverage check entirely. Useful on REQUIRED policy where grammar guarantees every sentence has a cite.

Returns: A fully-populated VerificationReport.