judgevet.adapters.inbound.cli_policy_eval
Status: draft.
judgevet.adapters.inbound.cli_policy_eval
Legacy answer checks over the shared pure policy comparisons.
The tuple and mutable-dictionary return shape remains compatible. Required confidence checks follow the historical CLI contract; strict public evaluation also checks unrequested confidence and original question constraints.
Examples:
from judgevet.adapters.inbound.cli_inputs import InputFailure
from judgevet.adapters.inbound.cli_policy import parse_policy
from judgevet.adapters.inbound.cli_policy_eval import evaluate_policy
from judgevet.domain.answers import NoulAnswer, ChoiceAnswer, ScoreAnswer
from judgevet.domain.questions import Choice, Noul, Score
questions = {
"noul": Noul(instructions="True?"),
"choice": Choice(criteria={"yes": "Yes"}),
"score": Score(criteria=["Poor", "Fair"]),
}
rules = parse_policy(
'{"rules":[{"question":"noul","pass":{"noul":{"min":0.42}}}]}', questions
)
passed, reports = evaluate_policy(rules, {"noul": NoulAnswer(noul=0.42)})
assert passed is True
See Also
- judgevet.adapters.inbound.cli_policy: Policy schema.
- judgevet.adapters.inbound.cli_inputs.InputFailure: Exception raised for invalid answers.
- judgevet.domain.answers: Typed answer definitions.
evaluate_policy(rules, answers)
Evaluate policy rules against typed answers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rules
|
tuple[Rule, ...]
|
Tuple of validated policy rules with score bounds. |
required |
answers
|
Mapping[str, Answer]
|
Mapping of question names to typed Answer objects. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Tuple of (overall_passed, list_of_reports). Overall passed is True only if |
list[dict[str, str | bool]]
|
all rules pass. Reports are generated for every rule in order. |
Raises:
| Type | Description |
|---|---|
InputFailure
|
If an answer is missing or has the wrong type for its rule. Also raised if any numeric value is nonfinite (nan/inf). |