This node takes answers generated by multiple Readers or Generators (such as PromptNode) and joins them into a single list of answers.

This is a utility node that simply merges multiple lists of answers to produce a single list. It can be useful if you're using multiple PromptNodes, each generating an answer, followed by a node that accepts a single answer rather than multiple lists of answers. You can then use JoinAnswers after the PromptNodes.

Basic Information

Join Modes

There are two join modes you can choose:

  • concatenate: Simply combines the answers into a single list.
  • merge: Aggregates scores of individual answers. With this mode, you can also specify the weights parameter, which assigns importance to the input nodes. By default, all nodes have equal weight.


Answers from LLMs

Note that answers coming from a large language model (LLM) have no score. Set sort_by_score=False to join the LLM's answers with answers from other nodes.
For more information, see the Arguments section below.

Usage Example

One use case for JoinAnswers could be that your documents contain different types of data, for example tables and text. In your pipeline, you're using RouteDocuments to route the documents to different readers, depending on their content type. Each reader returns predicted answers, and you can then use JoinAnswers to produce a final single list of answers.

  - name: Retriever
    type: TableTextRetriever
  - name: DocumentStore
    type: DeepsetCloudDocumentStore
      embedding_dim: 768
      similarity: cosine 
  - name: Router
    type: RouteDocuments
  - name: TextReader
    type: TransformersReader
  - name: TableReader
    type: TableReader
  - name: JoinAnswers
    type: JoinAnswers
      join_mode: concatenate
      top_k_join: 10
  - name: query
      - name: Retriever
        inputs: [Query]
      - name: Router
        inputs: [Retriever] 
      - name: TextReader
        inputs: [RouteDocuments.output_1]
      - name: TableReader
        inputs: [RouteDocuments.output_2]
      - name: JoinAnswers
        inputs: [TextReader, TableReader]


You can specify the following parameters for FileTypeClassifier in the pipeline YAML:

ParameterTypePossible ValuesDescription
Default: concatenate
The mode to use for joining answer lists.
concatenate - Combines answers into a single list.
merge - Aggregates scores of individual answers.
weightsList of float valuesDefault: noneUsed with the merge join mode. Assigns the importance to the input nodes. By default, answers from all nodes are assigned equal weight.
top_k_joinIntegerDefault: noneThe final number of answers to return in the resulting list.
Default: True
Sorts the incoming answers by their score. If any of the answers come from a Generator (like PromptNode), set this parameter to False, as these answers have no score.