Pipeline Components Overview
Components are the fundamental building blocks of your pipelines, dictating the flow of data. Each component performs a designated task on the data and then forwards the results to subsequent components.
How Components Work
Components receive predefined inputs within the pipeline, execute a specific function, and produce outputs. For example, a component may take files, convert them into embeddings, and pass these embeddings on to the next connected component. You have the flexibility to mix, match, and interchange components in your pipelines.
Components are often powered by language models, like LLMs or transformer models, to perform their tasks.
By default, components run on CPU. You can turn on GPU acceleration in the pipeline or index settings to speed up processing. For details, see GPU Acceleration.
Connecting Components: Inputs and Outputs
Components accept specific inputs and produce defined outputs. You can connect components with matching input and output types. For example, a retriever outputs List[Document] and a ranker accepts List[Document] as input, so their types match and you can connect them. A component must always receive all of its required inputs. For more about type matching, automatic conversions, and validation, see Pipeline Connections.
To connect components in Builder, drag a line between them or use the Connections panel at the bottom of the canvas to manage, inspect, and edit connections.

For detailed specifications on what inputs and outputs each component requires and generates, refer to the individual documentation pages for each component. The component's inputs and outputs are listed under Parameters:

Configuring Components
In Builder
In Builder, you simply add components to the canvas from the component library that opens when you click Add. You can then click the component to open its configuration panel and customize parameters. You can change the component name by clicking it and typing in a new name.
In YAML
The easiest way is to add the component to the canvas in Builder and then switch to the YAML editor to update the component's definition.
This is an example of how you can configure a component in the YAML:
components:
my_component: # this is a custom name
type: haystack.components.routers.file_type_router.FileTypeRouter # this is the component type you can find in component's documentation
init_parameters: {} # this uses the default parameter values
Connecting Components in YAML
As components can have multiple outputs, you must explicitly indicate the output you want to send to another component. You configure how components connect in the connections section of the YAML, specifying the custom names of the components and the names of their output and input. The output of the sender can have a different name than the input of the receiver as long as their types match, as in this example:
connections:
# we're connecting the text/plain output of the sender to the sources input of the receiver component
- sender: my_component.text/plain
receiver: text_converter.sources
If a component accepts outputs from multiple components, you explicitly define each connection, as in this example:
connections:
- sender: embedding_retriever.documents
receiver: joiner.documents
- sender: bm25_retriever.documents
receiver: joiner.documents
Component Types
Components are grouped by their function, for example, embedders, generators, and so on. Read about what the different types do to help you find appropriate components.
Embedders
Embedders convert text strings or Document objects into vector representations (embeddings). They use pre-trained models to do that.
Embeddings are vector representations of text that capture the context and meaning of words, rather than just relying on keywords. In LLM apps, they speed up processing and improve the model's ability to understand complex linguistic nuances and semantic understanding of text.
Text and Document Embedders
There are two types of embedders: text and document. Text embedders work with text strings and are most often used at the beginning of query pipelines to convert query text into vectors and send it to a retriever. Document embedders embed Document objects and are most often used in indexing pipelines, after converters, and before DocumentWriter.
You must use the same embedding model for text and documents. This means that if you use CohereDocumentEmbedder in your indexing pipeline, you must then use CohereTextEmbedder with the same model in your query pipeline.
LLM
To use a large language model (LLM) in your pipeline, add the LLM component. It works with any LLM provider and replaces the legacy Generators and ChatGenerators components. For details on using models, prompts, streaming, and the ChatMessage data class, see LLMs in Your Pipelines.
Haystack Components
Haystack is Haystack Platform's open source Python framework for building production-ready AI-based systems. Haystack Enterprise Platform is based on Haystack and uses its components, pipelines, and methods under the hood. To learn more about Haystack, see the Haystack website.
Related Information
Was this page helpful?