Add Krea2 eval entry templates

This commit is contained in:
2026-06-29 09:20:20 +02:00
parent 2aafab03bd
commit 6a37c807bc
4 changed files with 103 additions and 1 deletions
+20 -1
View File
@@ -2,6 +2,7 @@
from __future__ import annotations
import argparse
from datetime import date
import json
import sys
from pathlib import Path
@@ -25,12 +26,30 @@ def _load_entry(path: Path) -> dict:
def main() -> int:
parser = argparse.ArgumentParser(description="Validate and append one durable Krea2 fixed-seed eval entry.")
parser.add_argument("--entry-json", required=True, help="Path to a JSON object containing one eval entry.")
parser.add_argument("--entry-json", help="Path to a JSON object containing one eval entry.")
parser.add_argument("--print-template", action="store_true", help="Print a valid eval entry template instead of recording.")
parser.add_argument("--variant-key", help="Catalog variant key for --print-template.")
parser.add_argument("--seed", type=int, help="Fixed seed for --print-template.")
parser.add_argument("--source", default="sxcp_eval_mcp", help="Source label for --print-template.")
parser.add_argument("--date", default=date.today().isoformat(), help="Date for --print-template.")
parser.add_argument("--log-path", default=str(krea2_eval_log.DEFAULT_EVAL_LOG_PATH), help="Eval log path to update.")
parser.add_argument("--dry-run", action="store_true", help="Validate without writing the log.")
args = parser.parse_args()
try:
if args.print_template:
if not args.variant_key or args.seed is None:
raise ValueError("--print-template requires --variant-key and --seed")
entry = krea2_eval_log.entry_template(
args.variant_key,
seed=args.seed,
source=args.source,
date=args.date,
)
print(json.dumps(entry, ensure_ascii=True, indent=2))
return 0
if not args.entry_json:
raise ValueError("--entry-json is required unless --print-template is used")
entry = _load_entry(Path(args.entry_json))
log = krea2_eval_log.append_entry(entry, path=args.log_path, dry_run=args.dry_run)
except Exception as exc: