Haystack docs home page

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 PipelineBetween Retriever and Reader
InputDocuments
OutputDocuments
ClassesRouteDocuments

Usage

To initialize RouteDocuments so that it routes documents based on their content type (text vs. table):

route_documents = RouteDocuments()

To initialize RouteDocuments so that it routes documents based on a metadata field:

route_documents = RouteDocuments(
split_by="language",
metadata_values=["de", "en", "es"]
)