File size: 510 Bytes
564b5ea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""RAG Loader: ????? ????? ?? ???????."""
import os
import logging
from typing import List
from api.deps import get_logger

logger = get_logger("kapo.rag.loader")


def load_texts(paths: List[str]) -> List[str]:
    texts = []
    for p in paths:
        try:
            if os.path.exists(p):
                with open(p, "r", encoding="utf-8") as f:
                    texts.append(f.read())
        except Exception:
            logger.exception("Failed to load %s", p)
    return texts