Skip to content

statspai.checks

checks

Pluggable diagnostic-check protocol for StatsPAI results.

Check

Bases: Protocol

Protocol implemented by diagnostic checks.

validate

validate(result: Any, context: CheckContext) -> None

Raise if the check is not applicable to result.

run

run(result: Any, context: CheckContext) -> CheckResult

Run the check and return a structured result.

CheckContext dataclass

Context shared with pluggable diagnostic checks.

CheckResult dataclass

Result of one diagnostic or sensitivity check.

to_dict

to_dict() -> Dict[str, Any]

Return a JSON-safe payload for agents and reports.

RobustnessBatteryCheck

Adapter exposing run_robustness_battery as a pluggable check.

check_result_from_robustness_report

check_result_from_robustness_report(report: Any) -> CheckResult

Convert a RobustnessReport into the common CheckResult shape.

run_checks

run_checks(result: Any, checks: Iterable[Check], *, context: Optional[CheckContext] = None) -> List[CheckResult]

Run a list of pluggable checks against one result.