Production_Rag / data_loader.py
TharaKavin's picture
Upload 17 files
6f94597 verified
Raw
History Blame Contribute Delete
458 Bytes
import json
from typing import List, Dict, Any
def load_documents(path: str) -> Dict[str, Any]:
with open(path, "r", encoding="utf-8") as f:
data = json.load(f)
return data
def validate_document(data: Dict[str, Any]) -> bool:
required = ["doc_name", "structure"]
for field in required:
if field not in data:
return False
if not isinstance(data.get("structure"), list):
return False
return True