Faithfulness checks¶
limen_agents.checks ¶
Deterministic faithfulness checks on what a model writes.
The first rule of every agent here: a number in the text must come from the
data the model was given. :func:unknown_numbers finds the ones that do not.
:func:evaluate_briefing adds the rules of a briefing for the public: a length,
no bullet lists, no alarm terms, no orders to the reader (in Italian, the
language Limen writes in). Pure functions: no model, no I/O.
allowed_numbers_from_payload ¶
allowed_numbers_from_payload(payload: Any) -> set[str]
Collect every numeric token of an assessment payload, in the textual variants a briefing may quote (int, 1dp, 2dp, comma or dot decimals).
allowed_numbers_from_text ¶
allowed_numbers_from_text(text: str) -> set[str]
Come :func:allowed_numbers_from_payload, ma dal messaggio che il modello
ha ricevuto: รจ quello che spiegazioni_regione.ingresso conserva.
evaluate_briefing ¶
evaluate_briefing(text: str, *, allowed_numbers: set[str], min_words: int = 150, max_words: int = 250) -> BriefingEval
Check one briefing against the prompt's binding rules.
unknown_numbers ¶
unknown_numbers(text: str, source: str) -> list[str]
The numbers of text that are not in source, the message the model received.