-
Book Overview & Buying
-
Table Of Contents
Building Natural Language and LLM Pipelines
By :
In this section, we will walk through the process of refactoring our entire naive and hybrid RAG pipelines into reusable SuperComponents. This is achieved by passing the pipelines into the SuperComponent class. We will also use input type casting and output mapping to define the public interface of our new component.
Keeping our naive and hybrid pipelines as we had originally defined, and if our pipelines are named naive_rag_pipeline and hybrid_rag_pipeline, respectively, then the refactorization of the pipeline into a SuperComponent can be done via two methods.
The first method involves wrapping an instantiated pipeline. This is ideal when you have already defined a pipeline object and want to quickly abstract it without modifying the underlying class structure:
from haystack import SuperComponent
# Naive RAG
naive_rag_sc = SuperComponent(
pipeline=naive_rag_pipeline...