Reporting
Builders for environment evidence, run manifests, scorecards, compact summaries, and human-readable reports.
On this page
Reporting converts execution state into durable evidence. Builders return ordinary dictionaries for composition and testing; writer functions add canonical filenames and persist them. Secret-like values are redacted before environment or configuration data enters a manifest.
Import the symbols on this page from worldfoundry.evaluation.reporting.
build_env_requirements
This builder records whether required environment variable names and local paths are present without recording secret values. Optional dependency groups remain explicit in required_extras.
build_env_requirements
def build_env_requirements(required_env: Sequence[str | Mapping[str, Any]] = (),required_paths: Sequence[str | Path | Mapping[str, Any]] = (),required_extras: Sequence[str] = (),environ: Mapping[str, str] | None = None) -> dict[str, Any]Collect environment requirement claims for a run manifest (packages, CUDA, assets).
Parameters
required_envSequence[str | Mapping[str, Any]]default ()required_pathsSequence[str | Path | Mapping[str, Any]]default ()required_extrasSequence[str]default ()environMapping[str, str] | Nonedefault Noneos.environ`.Returns
build_environment
The environment payload captures Python, installed package versions, git metadata, and relevant cache paths. Passing package_names narrows package collection when a full environment inventory would be excessive.
build_environment
def build_environment(repo_root: str | Path | None = None,cache_paths: Mapping[str, Any] | None = None,package_names: Sequence[str] | None = None) -> dict[str, Any]Snapshot the executing environment for reproducibility evidence in the run manifest.
Parameters
repo_rootstr | Path | Nonedefault Nonecache_pathsMapping[str, Any] | Nonedefault Nonepackage_namesSequence[str] | Nonedefault NoneReturns
build_run_manifest
This function enriches a runner's base manifest with redacted configuration, environment evidence, revisions, cache paths, reproducibility fields, and a stable manifest hash.
build_run_manifest
def build_run_manifest(base_manifest: Mapping[str, Any],config: Mapping[str, Any] | None = None,environment: Mapping[str, Any] | None = None,env_requirements: Mapping[str, Any] | None = None,seed: int | str | None = None,cache_paths: Mapping[str, Any] | None = None,environment_path: str | Path | None = None,env_requirements_path: str | Path | None = None) -> dict[str, Any]Build the run manifest document that records request, environment, and artifact index.
Parameters
base_manifestMapping[str, Any]configMapping[str, Any] | Nonedefault NoneenvironmentMapping[str, Any] | Nonedefault Nonebuild_environment`.env_requirementsMapping[str, Any] | Nonedefault Nonebuild_env_requirements`.seedint | str | Nonedefault Nonecache_pathsMapping[str, Any] | Nonedefault Noneenvironment_pathstr | Path | Nonedefault Noneenvironment.json`.env_requirements_pathstr | Path | Nonedefault Noneenv_requirements.json`.Returns
write_run_manifest_artifacts
Use the writer when a custom runner should emit the standard manifest trio in one operation.
from worldfoundry.evaluation.reporting import write_run_manifest_artifacts
paths = write_run_manifest_artifacts(
output_dir="tmp/custom_run",
base_manifest={
"run": {"run_id": "custom-0001", "status": "succeeded"},
"model": {"model_id": "my-model", "revision": "abc123"},
"dataset": {"dataset_id": "my-samples", "split": "validation"},
},
config={"seed": 42, "device": "cuda:0"},
required_env=("HF_TOKEN",),
required_paths=("/data/my-samples",),
required_extras=("video",),
seed=42,
)
print(paths["run_manifest"])An absent HF_TOKEN or dataset path is recorded as missing evidence; the function does not reveal the token or invent the path.
write_run_manifest_artifacts
def write_run_manifest_artifacts(output_dir: str | Path,base_manifest: Mapping[str, Any],config: Mapping[str, Any] | None = None,required_env: Sequence[str | Mapping[str, Any]] = (),required_paths: Sequence[str | Path | Mapping[str, Any]] = (),required_extras: Sequence[str] = (),seed: int | str | None = None,cache_paths: Mapping[str, Any] | None = None,repo_root: str | Path | None = None,package_names: Sequence[str] | None = None,environ: Mapping[str, str] | None = None,manifest_path: str | Path | None = None,environment_path: str | Path | None = None,env_requirements_path: str | Path | None = None,environment: Mapping[str, Any] | None = None) -> dict[str, Path]Persist run manifest JSON (and companions) into the run output directory.
Parameters
output_dirstr | Pathbase_manifestMapping[str, Any]configMapping[str, Any] | Nonedefault Nonerequired_envSequence[str | Mapping[str, Any]]default ()required_pathsSequence[str | Path | Mapping[str, Any]]default ()required_extrasSequence[str]default ()seedint | str | Nonedefault Nonecache_pathsMapping[str, Any] | Nonedefault Nonerepo_rootstr | Path | Nonedefault Nonepackage_namesSequence[str] | Nonedefault NoneenvironMapping[str, str] | Nonedefault Nonemanifest_pathstr | Path | Nonedefault Nonerun_manifest.json`.environment_pathstr | Path | Nonedefault Noneenvironment.json`.env_requirements_pathstr | Path | Nonedefault Noneenv_requirements.json`.environmentMapping[str, Any] | Nonedefault NoneReturns
build_scorecard
The scorecard combines run identity, model, benchmark, dataset, generation, metrics, artifacts, provenance, and skipped work. Its leaderboard gate is conservative: successful metric computation alone does not establish complete official evidence.
build_scorecard
def build_scorecard(run: Mapping[str, Any],benchmark: Mapping[str, Any],model: Mapping[str, Any],dataset: Mapping[str, Any],generation: Mapping[str, Any],metrics_summary: Mapping[str, Any],artifacts: Mapping[str, Any],skipped: Mapping[str, Any] | None = None,leaderboard_evidence: Mapping[str, Any] | None = None,provenance: Mapping[str, Any] | None = None,evaluation_kind: str = 'existing_results',comparison_identity: Mapping[str, Any] | None = None) -> dict[str, Any]Assemble the scorecard summary from metric aggregates and protocol outcomes.
Parameters
runMapping[str, Any]benchmarkMapping[str, Any]modelMapping[str, Any]datasetMapping[str, Any]generationMapping[str, Any]metrics_summaryMapping[str, Any]artifactsMapping[str, Any]skippedMapping[str, Any] | Nonedefault Noneleaderboard_evidenceMapping[str, Any] | Nonedefault NoneprovenanceMapping[str, Any] | Nonedefault Noneevaluation_kindstrdefault 'existing_results'comparison_identityMapping[str, Any] | Nonedefault NoneReturns
write_scorecard
This convenience function builds a scorecard with the same keyword arguments and writes it as JSON. It also indexes its own resolved path under artifacts.scorecard.
write_scorecard
def write_scorecard(path: str | Path,**kwargs: Any) -> PathWrite scorecard artifacts to disk for leaderboards and human review.
Parameters
pathstr | PathkwargsAnybuild_scorecard.Returns
build_run_summary
A summary keeps the comparison-oriented subset of a scorecard: identities, fidelity, sample counts, leaderboard values, eligibility, and artifact paths. It is suitable for indexes and cross-run comparisons.
build_run_summary
def build_run_summary(scorecard: Mapping[str, Any]) -> dict[str, Any]Build a compact run summary structure used by reports and UIs.
Parameters
scorecardMapping[str, Any]Returns
build_markdown_report
This renderer converts a compact summary into the human-readable report.md. It does not recompute scores or change eligibility.
build_markdown_report
def build_markdown_report(summary: Mapping[str, Any]) -> strRender a human-readable Markdown report from the run summary and scorecard.
Parameters
summaryMapping[str, Any]Returns
write_run_report_artifacts
Given an in-memory scorecard or a scorecard.json path, this writer produces summary.json and report.md together.
write_run_report_artifacts
def write_run_report_artifacts(output_dir: str | Path,scorecard_path: str | Path | None = None,summary_path: str | Path | None = None,report_path: str | Path | None = None,scorecard: Mapping[str, Any] | None = None) -> dict[str, Path]Write Markdown/HTML (or related) report files beside other run evidence.
Parameters
output_dirstr | Pathscorecard_pathstr | Path | Nonedefault Nonesummary_pathstr | Path | Nonedefault Nonereport_pathstr | Path | Nonedefault NonescorecardMapping[str, Any] | Nonedefault NoneReturns
"summary" and "report" to resolved Path` objects.In normal CLI and run_worldfoundry flows these writers are called for you. Use them directly when an external runtime or custom orchestration layer must emit the same evidence layout.