1
0
Fork 0
taleweave-ai/taleweave/utils/systems.py

17 lines
350 B
Python

from pydantic import RootModel
from taleweave.utils.file import load_yaml, save_yaml
def load_system_data(cls, file):
with open(file, "r") as f:
data = load_yaml(f)
return cls(**data)
def save_system_data(cls, file, model):
data = RootModel[cls](model).model_dump()
with open(file, "w") as f:
save_yaml(f, data)