How to implement a chain of multiple retrievers? #2681
-
Question |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
retrievers only support Documentstores as their input and we don't have plans to change this, but depending on your use case, you might find helpful using a ranker, specifically the retriever = BM25Retriever(document_store=document_store)
ranker = SentenceTransformersRanker(model_name_or_path="cross-encoder/ms-marco-MiniLM-L-12-v2")
p = Pipeline()
p.add_node(component=retriever, name="ESRetriever", inputs=["Query"])
p.add_node(component=ranker, name="Ranker", inputs=["ESRetriever"]) |
Beta Was this translation helpful? Give feedback.
Hi @nasrin-taghizadeh
retrievers only support Documentstores as their input and we don't have plans to change this, but depending on your use case, you might find helpful using a ranker, specifically the
SentenceTransformersRanker
. This node can take the input from (e.g.) a BM25 retriever and use a transformer model to sort its results. We have an example in our docs (I'm linking the code because the documentation website has a problem rendering this specific snippet):