Skip to main content

rig_core/loaders/
mod.rs

1//! File loading utilities for preparing local documents as model or embedding input.
2//!
3//! [`FileLoader`] provides a common interface for reading files from disk, glob
4//! matches, directories, or in-memory bytes. It can return content alone or pair
5//! content with source paths, and it can optionally skip per-file errors.
6//!
7//! `PdfFileLoader` is available with the `pdf` feature. It loads PDFs and can
8//! split extracted text by page while preserving page numbers.
9//!
10//! `EpubFileLoader` is available with the `epub` feature. It loads EPUB files
11//! and can split extracted text by chapter while preserving chapter numbers.
12
13pub mod file;
14
15pub use file::FileLoader;
16
17// Test-only helpers for resolving on-disk fixtures in a CWD-independent way.
18// Gated to the features whose tests use them so it never warns as dead code.
19#[cfg(all(test, any(feature = "pdf", feature = "epub")))]
20mod test_fixtures;
21
22#[cfg(feature = "pdf")]
23#[cfg_attr(docsrs, doc(cfg(feature = "pdf")))]
24pub mod pdf;
25
26#[cfg(feature = "pdf")]
27pub use pdf::PdfFileLoader;
28
29#[cfg(feature = "epub")]
30#[cfg_attr(docsrs, doc(cfg(feature = "epub")))]
31pub mod epub;
32
33#[cfg(feature = "epub")]
34pub use epub::{EpubFileLoader, RawTextProcessor, StripXmlProcessor, TextProcessor};