mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-11-16 10:03:44 +00:00
* fix RouteDocuments documentation * Update Documentation & Code Style Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
4.0 KiB
4.0 KiB
Module docs2answers
Docs2Answers
class Docs2Answers(BaseComponent)
This Node is used to convert retrieved documents into predicted answers format. It is useful for situations where you are calling a Retriever only pipeline via REST API. This ensures that your output is in a compatible format.
Module join_docs
JoinDocuments
class JoinDocuments(BaseComponent)
A node to join documents outputted by multiple retriever nodes.
The node allows multiple join modes:
- concatenate: combine the documents from multiple nodes. Any duplicate documents are discarded.
- merge: merge scores of documents from multiple nodes. Optionally, each input score can be given a different
weight& atop_klimit can be set. This mode can also be used for "reranking" retrieved documents. - reciprocal_rank_fusion: combines the documents based on their rank in multiple nodes.
__init__
def __init__(join_mode: str = "concatenate", weights: Optional[List[float]] = None, top_k_join: Optional[int] = None)
Arguments:
join_mode:concatenateto combine documents from multiple retrieversmergeto aggregate scores of individual documents,reciprocal_rank_fusionto apply rank based scoring.weights: A node-wise list(length of list must be equal to the number of input nodes) of weights for adjusting document scores when using themergejoin_mode. By default, equal weight is given to each retriever score. This param is not compatible with theconcatenatejoin_mode.top_k_join: Limit documents to top_k based on the resulting scores of the join.
Module join_answers
JoinAnswers
class JoinAnswers(BaseComponent)
A node to join Answers produced by multiple Reader nodes.
__init__
def __init__(join_mode: str = "concatenate", weights: Optional[List[float]] = None, top_k_join: Optional[int] = None)
Arguments:
join_mode:"concatenate"to combine documents from multipleReaders."merge"to aggregate scores of individualAnswers.weights: A node-wise list (length of list must be equal to the number of input nodes) of weights for adjustingAnswerscores when using the"merge"join_mode. By default, equal weight is assigned to eachReaderscore. This parameter is not compatible with the"concatenate"join_mode.top_k_join: LimitAnswers to top_k based on the resulting scored of the join.
Module route_documents
RouteDocuments
class RouteDocuments(BaseComponent)
A node to split a list of Documents by content_type or by the values of a metadata field and route them to
different nodes.
__init__
def __init__(split_by: str = "content_type", metadata_values: Optional[List[str]] = None)
Arguments:
split_by: Field to split the documents by, either"content_type"or a metadata field name. If this parameter is set to"content_type", the list ofDocuments will be split into a list containing onlyDocuments of type"text"(will be routed to"output_1") and a list containing onlyDocuments of type"table"(will be routed to"output_2"). If this parameter is set to a metadata field name, you need to specify the parametermetadata_valuesas well.metadata_values: If the parametersplit_byis set to a metadata field name, you need to provide a list of values to group theDocuments to.Documents whose metadata field is equal to the first value of the provided list will be routed to"output_1",Documents whose metadata field is equal to the second value of the provided list will be routed to"output_2", etc.