StringJoiner
Join strings from different components to a single list of strings.
Basic Information
- Type:
haystack.components.joiners.string_joiner.StringJoiner - Components it can connect with:
- Any component that outputs strings, such as generators or extractors.
Inputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| strings | Variadic[str] | strings from different components |
Outputs
| Parameter | Type | Default | Description |
|---|---|---|---|
| strings | List[str] | Merged list of strings. |
Overview
StringJoiner collects strings from different components and joins them into a single list of strings. This component is useful when you need to aggregate text outputs from multiple sources in a pipeline.
Usage Example
This example shows a pipeline that creates multiple prompt strings and joins them together.
components:
PromptBuilder1:
type: haystack.components.builders.prompt_builder.PromptBuilder
init_parameters:
template: "Question 1: {{ query }}"
PromptBuilder2:
type: haystack.components.builders.prompt_builder.PromptBuilder
init_parameters:
template: "Question 2: {{ query }}"
PromptBuilder3:
type: haystack.components.builders.prompt_builder.PromptBuilder
init_parameters:
template: "Question 3: {{ query }}"
StringJoiner:
type: haystack.components.joiners.string_joiner.StringJoiner
init_parameters: {}
connections:
- sender: PromptBuilder1.prompt
receiver: StringJoiner.strings
- sender: PromptBuilder2.prompt
receiver: StringJoiner.strings
- sender: PromptBuilder3.prompt
receiver: StringJoiner.strings
max_runs_per_component: 100
metadata: {}
inputs:
query:
- PromptBuilder1.query
- PromptBuilder2.query
- PromptBuilder3.query
Parameters
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|
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 |
|---|---|---|---|
| strings | Variadic[str] | strings from different components |
Was this page helpful?