MCPcopy Create free account
hub / github.com/Dizzy-K/AutoPT / _normalize_payload

Function _normalize_payload

analysis/loader.py:138–161  ·  view source on GitHub ↗
(
    payload: dict[str, Any],
    source_path: Path,
    benchmark_index: dict[str, dict[str, Any]],
)

Source from the content-addressed store, hash-verified

136
137
138def _normalize_payload(
139 payload: dict[str, Any],
140 source_path: Path,
141 benchmark_index: dict[str, dict[str, Any]],
142) -> Iterator[NormalizedResult]:
143 schema_version = _normalize_result_namespace(payload.get("schema_version", ""))
144 if schema_version in {"autopt.experiment_report.v1", "autopt.legacy_main_compat.v1"}:
145 for item in payload.get("results", []):
146 if isinstance(item, dict):
147 yield _normalize_task_result(item, source_path, benchmark_index)
148 for report in payload.get("reports", []):
149 if not isinstance(report, dict):
150 continue
151 for item in report.get("results", []):
152 if isinstance(item, dict):
153 yield _normalize_task_result(item, source_path, benchmark_index)
154 return
155
156 if schema_version == "autopt.task_result.v1" or {"status", "benchmark_name", "model_alias"}.issubset(payload):
157 yield _normalize_task_result(payload, source_path, benchmark_index)
158 return
159
160 if "flag" in payload:
161 yield _normalize_legacy_result(payload, source_path, benchmark_index)
162
163
164def _normalize_task_result(

Callers 1

_iter_jsonl_resultsFunction · 0.85

Calls 3

_normalize_task_resultFunction · 0.85
_normalize_legacy_resultFunction · 0.85

Tested by

no test coverage detected