MrA7A1's picture
Initial modernized KAPO runtime upload
06ce7ac verified
raw
history blame contribute delete
510 Bytes
"""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