File size: 608 Bytes
82f0b9f
d9a3b5a
82f0b9f
 
 
 
d9a3b5a
 
 
 
 
 
 
 
 
 
 
82f0b9f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import json
from typing import List, Dict, Any
from rag.logging_utils import get_logger

logger = get_logger(__name__)

def load_dataset(path: str) -> List[Dict[str, Any]]:
    try:
        with open(path, "r", encoding="utf-8") as f:
            data = json.load(f)
        if not isinstance(data, list):
            logger.warning("Dataset JSON is not a list. Found: %s", type(data))
            return []
        logger.info("Loaded dataset: %d docs", len(data))
        return data
    except Exception as e:
        logger.warning("⚠️ Dataset not found/invalid (%s): %s", path, e)
        return []