File size: 447 Bytes
ff5d8c3
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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