File size: 928 Bytes
526950e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""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