Spaces:
Running on T4
Running on T4
File size: 614 Bytes
35e80ff | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | """Write docs/coach_input.schema.json and docs/coach_note.schema.json from the pydantic models."""
import json
from pathlib import Path
from ai_coach.schemas import CoachInput, CoachNote
DOCS = Path(__file__).resolve().parents[1] / "docs"
def render(model) -> str:
return json.dumps(model.model_json_schema(), indent=2, sort_keys=True) + "\n"
if __name__ == "__main__":
DOCS.mkdir(exist_ok=True)
(DOCS / "coach_input.schema.json").write_text(render(CoachInput), encoding="utf-8")
(DOCS / "coach_note.schema.json").write_text(render(CoachNote), encoding="utf-8")
print("schemas written")
|