Class DocumentLoader
java.lang.Object
dev.langchain4j.data.document.DocumentLoader
Utility class for loading documents.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Documentload(DocumentSource source, DocumentParser parser) Loads a document from the given source using the given parser.
-
Method Details
-
load
Loads a document from the given source using the given parser.Forwards the source Metadata to the parsed Document. If both define the same metadata key with a different value, the source value is kept, the document value is discarded, and a warning is logged. To control which value is kept, remove the key in your
DocumentParserbefore returning theDocument.- Parameters:
source- The source from which the document will be loaded.parser- The parser that will be used to parse the document.- Returns:
- The loaded document.
- Throws:
BlankDocumentException- when the parsedDocumentis blank/empty.
-