CoolFace
Apppublic

projecte-aina/EADOP-RAG

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
2likes
input_reader.py23 linesDownload Raw Back to root
1from typing import List2 3from llama_index.core.constants import DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE4from llama_index.core.readers import SimpleDirectoryReader5from llama_index.core.schema import Document6from llama_index.core import Settings7 8 9class InputReader:10    def __init__(self, input_dir: str) -> None:11        self.reader = SimpleDirectoryReader(input_dir=input_dir)12 13    def parse_documents(14        self,15        show_progress: bool = True,16        chunk_size: int = DEFAULT_CHUNK_SIZE,17        chunk_overlap: int = DEFAULT_CHUNK_OVERLAP,18    ) -> List[Document]:19        Settings.chunk_size = chunk_size20        Settings.chunk_overlap = chunk_overlap21        documents = self.reader.load_data(show_progress=show_progress)22        return documents23