Spaces:
Sleeping
Sleeping
Download scripts/lib/chat_eval/misconceptions.py from defenestrate/asa: direct link, hf CLI and curl.
- Browser
- Download file 928 Bytes
-
https://huggingface.co/spaces/defenestrate/asa/resolve/main/scripts/lib/chat_eval/misconceptions.py
- Command line
-
hf download hf://spaces/defenestrate/asa/scripts/lib/chat_eval/misconceptions.py
-
curl -L -o misconceptions.py https://huggingface.co/spaces/defenestrate/asa/resolve/main/scripts/lib/chat_eval/misconceptions.py
928 Bytes
| """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 | |