Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

ListJoiner (Legacy)

A legacy component that joins multiple lists into a single flat list.

Legacy Component

With smart connections, components can accept connections from multiple lists of the same type, making ListJoiner no longer necessary. It's no longer available in Builder's component library but you can still use and configure it through YAML. To learn how to remove it from your pipelines, see Simplify Your Pipelines with Smart Connections.

Key Features

  • Receives multiple lists of the same type and concatenates them into a single flat list.
  • Output order respects the pipeline's execution sequence, with earlier inputs being added first.
  • Useful for combining list outputs from multiple components.

Configuration

ListJoiner is no longer available in Pipeline Builder's component library. Configure it through the pipeline YAML directly.

Connections

ListJoiner accepts multiple list inputs through its values input. Connect any component that outputs lists of the same type, such as generators that output List[ChatMessage] or other list-producing components.

It outputs the joined list through its values output. Connect it to any downstream component that accepts a list input.

Source Code

To check this component's source code, open list_joiner.py in the Haystack repository.

Usage Examples

Basic Configuration

  ListJoiner:
type: haystack.components.joiners.list_joiner.ListJoiner
init_parameters:
list_type_: list[haystack.dataclasses.document.Document]

This example shows an index that converts different file types (text, markdown, PDF) and joins all documents into a single list for processing.

components:
TextFileToDocument:
type: haystack.components.converters.txt.TextFileToDocument
init_parameters:
encoding: utf-8
store_full_path: false
MarkdownToDocument:
type: haystack.components.converters.markdown.MarkdownToDocument
init_parameters:
store_full_path: false
PDFMinerToDocument:
type: haystack.components.converters.pdfminer.PDFMinerToDocument
init_parameters:
store_full_path: false
ListJoiner:
type: haystack.components.joiners.list_joiner.ListJoiner
init_parameters:
list_type_: list[haystack.dataclasses.document.Document]
DocumentSplitter:
type: haystack.components.preprocessors.document_splitter.DocumentSplitter
init_parameters:
split_by: sentence
split_length: 100
split_overlap: 0
split_threshold: 0
splitting_function:
DocumentWriter:
type: haystack.components.writers.document_writer.DocumentWriter
init_parameters:
policy: OVERWRITE
document_store:
type: haystack.document_stores.in_memory.document_store.InMemoryDocumentStore
init_parameters:
bm25_tokenization_regex: (?u)\b\w\w+\b
bm25_algorithm: BM25L
bm25_parameters:
embedding_similarity_function: dot_product
index: 'default'
async_executor:
return_embedding: true

FileTypeRouter:
type: haystack.components.routers.file_type_router.FileTypeRouter
init_parameters:
mime_types:
- application/pdf
- text/markdown
- text/plain
additional_mimetypes:
raise_on_failure: false

connections:
- sender: TextFileToDocument.documents
receiver: ListJoiner.values
- sender: MarkdownToDocument.documents
receiver: ListJoiner.values
- sender: PDFMinerToDocument.documents
receiver: ListJoiner.values
- sender: ListJoiner.values
receiver: DocumentSplitter.documents
- sender: DocumentSplitter.documents
receiver: DocumentWriter.documents

- sender: FileTypeRouter.application/pdf
receiver: PDFMinerToDocument.sources
- sender: FileTypeRouter.text/markdown
receiver: MarkdownToDocument.sources
- sender: FileTypeRouter.text/plain
receiver: TextFileToDocument.sources

max_runs_per_component: 100

metadata: {}

inputs:
files:
- FileTypeRouter.sources

Parameters

Inputs

ParameterTypeDefaultDescription
valuesVariadic[List[Any]]The lists to be joined.

Outputs

ParameterTypeDefaultDescription

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
list_type_Optional[Type]NoneThe expected type of the lists this component will join (for example, List[ChatMessage]). If specified, all input lists must conform to this type. If None, the component defaults to handling lists of any type including mixed types.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
valuesVariadic[List[Any]]The list to be joined.