AI / LangChain4j interview questions
What is the DocumentLoader API in LangChain4j and what sources does it support?
Document loaders are the entry point of any RAG ingestion pipeline — they read raw content from a source and return it as a list of Document objects, each containing the text content and source metadata. LangChain4j's loaders all implement the DocumentLoader interface and populate the Document.metadata() map with source-specific information like file path, URL, or S3 key.
Built-in document loader sources include:
| Loader | Source | Notes |
|---|---|---|
| FileSystemDocumentLoader | Local files and directories | Supports glob patterns; auto-detects parser by extension |
| UrlDocumentLoader | HTTP/HTTPS URLs | Fetches and parses web pages |
| ClassPathDocumentLoader | Classpath resources | Good for embedded documentation in JARs |
| AmazonS3DocumentLoader | AWS S3 buckets | Via langchain4j-document-loader-amazon-s3 |
| AzureBlobStorageDocumentLoader | Azure Blob Storage | Via langchain4j-document-loader-azure-storage-blob |
| GitHubDocumentLoader | GitHub repositories | Loads files from a repo branch |
Document parsers handle format-specific extraction: TextDocumentParser for plain text, ApachePdfBoxDocumentParser for PDFs, ApacheTikaDocumentParser for Word/Excel/PowerPoint and 100+ other formats. Parsers are composable with loaders:
// Load all PDFs from a directory
List<Document> docs = FileSystemDocumentLoader.loadDocuments(
"./knowledge-base",
PathMatcher.of("glob:**.pdf"),
new ApachePdfBoxDocumentParser()
);
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
