Files
AI/참고/guardrails-main/server_ci/config.py

16 lines
397 B
Python
Raw Normal View History

2026-05-12 19:40:31 +09:00
import json
import os
from guardrails import Guard
try:
file_path = os.path.join(os.getcwd(), "guard-template.json")
with open(file_path, "r") as fin:
guards = json.load(fin)["guards"] or []
except json.JSONDecodeError:
print("Error parsing guards from JSON")
SystemExit(1)
# instantiate guards
guard0 = Guard.from_dict(guards[0])
guard0.id = guard0.name # type: ignore