DirectoryLoader supplies the document-loading stage of a retrieval-augmented generation pipeline. It recursively traverses a documentation directory, selects matching files, and returns standardized Document objects with content and metadata such as file paths and modification dates. section 12.2.4
RAG indexing pipeline
load_documents(data_dir) feeds documents into RecursiveCharacterTextSplitter, then a FAISS index. A similarity search can validate the resulting index with an operational question such as “How do I rotate encryption keys?”

