Skip to content

Commit 3b6c3bf

Browse files
committed
Add storage.py
1 parent d7dd9f0 commit 3b6c3bf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

core/storage.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import json
2+
import os
3+
from typing import Dict, Any
4+
5+
6+
class Storage:
7+
"""
8+
v0.1 Storage:
9+
Saves provenance records to disk as JSON files.
10+
"""
11+
12+
@staticmethod
13+
def save(record: Dict[str, Any], directory: str = "records") -> str:
14+
os.makedirs(directory, exist_ok=True)
15+
16+
filename = f"{directory}/{record['intent_id']}.json"
17+
18+
with open(filename, "w") as f:
19+
json.dump(record, f, indent=2)
20+
21+
return filename

0 commit comments

Comments
 (0)