Find answers from the community

Updated 2 months ago

Score

Hi,

How can I get the score based results directly during retrieval process instead of using similarity_top_k
L
t
4 comments
I'm not sure what you mean exactly? You can get the scores the nodes directly

Plain Text
retriever = index.as_retriever(similarity_top_k=2)
nodes = retriever.retrieve("query")
print(nodes[0].score)
So here we are mentioning the similarity_top_k which takes top n documents where n is number that was predefined.

I have a use case where users might select a value on scale of 0 to 1 where 0 means less relevant data and 1 means more relevant data.
So here we are retrieving the nodes based on relevance not based on number of documents.

Performing search results based on relevance is more useful than limiting nodes with top_k param
I want to retrieve nodes with score relevance of 0.5 and greater, so the number of nodes that I get from search results might be either 20, 200 or 200k it doesn't matter.
I will be just processing all those nodes and generate response using custom LLM
I don't think there's an option for this, other than setting the top k to some crazy value, and then doing some postprocessing on the results
Add a reply
Sign up and join the conversation on Discord