Find answers from the community

Updated 9 months ago

Rerank

how do i set bge or local model has reranker
L
d
4 comments
You can use the SentenceTransformerRerank class

pip install llama-index-postprocessor-sbert-rerank

Plain Text
from llama_index.postprocessor.sbert_rerank import SentenceTransformerRerank
postprocessor = SentenceTransformerRerank(
    model="<model name>", top_n=3
)
What does the transformation pipeline do exactly
it takes a list of nodes, compares their text to the query text using the model, re-ranks/re-oders them, and then returns the top-n
So I might set my top-k to 6, rerank, and return the top-n as 3
Add a reply
Sign up and join the conversation on Discord