Spaces:
Runtime error
Runtime error
| import yaml | |
| import os | |
| def load_persona(path): | |
| if not os.path.exists(path): | |
| raise FileNotFoundError(f"Persona file not found: {path}") | |
| with open(path, "r", encoding="utf-8") as f: | |
| persona = yaml.safe_load(f) | |
| required_keys = ["name", "dynamic_state", "segment_drift"] | |
| for key in required_keys: | |
| if key not in persona: | |
| raise ValueError(f"Missing required key: {key}") | |
| return persona |