rag.core.loaders ================ .. py:module:: rag.core.loaders .. autoapi-nested-parse:: Framework-agnostic PDF page loading for ingest backends. Classes ------- .. autoapisummary:: rag.core.loaders.PageDocument Functions --------- .. autoapisummary:: rag.core.loaders.list_pdf_paths rag.core.loaders.load_pdf_pages Module Contents --------------- .. py:class:: PageDocument One extractable PDF page. :ivar text: Prose text from the page. :vartype text: str :ivar metadata: File name, path, and 1-based page fields shared by all backends. :vartype metadata: dict .. py:attribute:: text :type: str .. py:attribute:: metadata :type: dict[str, Any] .. py:function:: list_pdf_paths(*, papers_dir: pathlib.Path) -> list[pathlib.Path] List PDF files under ``papers_dir`` (non-recursive). :param papers_dir: Directory containing PDFs. :type papers_dir: Path :returns: Sorted PDF paths. :rtype: list of Path :raises FileNotFoundError: If the directory does not exist or contains no PDFs. .. py:function:: load_pdf_pages(*, pdf_paths: collections.abc.Sequence[pathlib.Path]) -> list[PageDocument] Extract per-page prose from PDFs with pypdf. Pages that fail ``is_prose_text`` (figures, dedications, glyph salad) are skipped. :param pdf_paths: PDF files to load. :type pdf_paths: sequence of Path :returns: One document per extractable page. :rtype: list of PageDocument :raises FileNotFoundError: If no page yields extractable text.