Skip to content

How to implement a chain of multiple retrievers? #2681

Discussion options

You must be logged in to vote

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):

    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="E…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@nasrin-taghizadeh
Comment options

@nasrin-taghizadeh
Comment options

@tstadel
Comment options

tstadel Jul 6, 2022
Collaborator

@nasrin-taghizadeh
Comment options

Answer selected by nasrin-taghizadeh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #2680 on June 20, 2022 08:12.