ListJoiner (Legacy)
A legacy component that joins multiple lists into a single flat list.
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
- Concatenates multiple input lists of the same type into a single flat list.
- Preserves order based on the pipeline's execution sequence.
- Accepts any list type, including
List[Document]andList[ChatMessage]. - Optionally enforces type safety by specifying the expected list type.
- Useful for combining outputs from parallel converters or processors.
Configuration
- Drag the
ListJoinercomponent onto the canvas from the Component Library. - Click the component to open the configuration panel.
- Configure the parameters as needed.
Connections
ListJoiner accepts multiple values inputs — any component that outputs a list of the same type can connect to it. It outputs values, a single concatenated list. Connect its output to DocumentSplitter, DocumentWriter, or any other component that accepts a list input.
Usage Example
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
| Parameter | Type | Default | Description |
|---|---|---|---|
| values | Variadic[List[Any]] | The lists to be joined. |
Outputs
| Parameter | Type | Default | Description |
|---|
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
| list_type_ | Optional[Type] | None | The 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
| values | Variadic[List[Any]] | The list to be joined. |
Was this page helpful?