RouteDocuments
This Node routes Documents to different branches of your pipeline based on their content_type or a metadata field. RouteDocuments is a decision node.
This node is handy if you have different types of data, for example tables and text. You can then use it to route each document type to a Reader trained on it.
Position in a Pipeline | Between Retriever and Reader |
Input | Documents |
Output | Documents |
Classes | RouteDocuments |
Usage
To initialize RouteDocuments so that it routes documents based on their content type (text vs. table):
Copied!
route_documents = RouteDocuments()
To initialize RouteDocuments so that it routes documents based on a metadata field:
Copied!
route_documents = RouteDocuments( split_by="language", metadata_values=["de", "en", "es"])