"""Faculty-maintained misconception list loader. The file lives at content/chat-eval/misconceptions.yaml and is editable in place; the judge re-loads fresh each batch so changes pick up without rebuild. """ from __future__ import annotations from pathlib import Path import yaml def load_misconceptions(path: Path) -> list[dict]: """Load the misconception list from a YAML file. Each entry is a dict with id, name, technical, colloquial, faculty_displacement_target, example_queries. Raises FileNotFoundError if the file doesn't exist. """ if not path.is_file(): raise FileNotFoundError(f"misconceptions file not found: {path}") with open(path, "r", encoding="utf-8") as f: data = yaml.safe_load(f) if not isinstance(data, list): raise ValueError( f"misconceptions file at {path} must be a YAML list, got {type(data).__name__}" ) return data