Package dev.langchain4j.data.document
Interface DocumentTransformer
- All Known Implementing Classes:
HtmlToTextDocumentTransformer
public interface DocumentTransformer
Defines the interface for transforming a
Document
.
Implementations can perform a variety of tasks such as transforming, filtering, enriching, etc.-
Method Summary
-
Method Details
-
transform
Transforms a provided document.- Parameters:
document
- The document to be transformed.- Returns:
- The transformed document, or null if the document should be filtered out.
-
transformAll
Transforms all the provided documents.- Parameters:
documents
- A list of documents to be transformed.- Returns:
- A list of transformed documents. The length of this list may be shorter or longer than the original list. Returns an empty list if all documents were filtered out.
-