Find answers from the community

Updated 2 months ago

Hi there, I want to use LlamaIndex to

Hi there, I want to use LlamaIndex to rerank a set of data in JSON format based on a sentence I provide. How should I go about this? I feel like the entire LlamaIndex file is too large, and I'm not sure where to start. 😭
L
2 comments
rerankers are mostly meant to be used in context with retrieval in llama-index

I would just use a reranking library out of the box for this if you aren't doing this with retrieval
pip install -U FlagEmbedding

Plain Text
from FlagEmbedding import FlagReranker
reranker = FlagReranker('BAAI/bge-reranker-v2-m3', use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation

scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']], normalize=True)
print(scores) # [0.00027803096387751553, 0.9948403768236574]


https://huggingface.co/BAAI/bge-reranker-v2-m3
Add a reply
Sign up and join the conversation on Discord