Get cosine score while querying index
Hi, Is there a way to overload or method available for index.query method to get the cosine score as well ?
You can get the source_nodes from the response object and it will include the similarity score. Is this what you're looking for?
yep! exactly what @ymansurozer mentioned.
@ymansurozer is it possible to query these source nodes without the call to the LLM? If I'm just using the response.source_nodes, I dont want the query function to waste time and resources.
yeah just set response_mode="no_text" during the index.query call
@jerryjliu Thank you!
going to close this issue for now since seems resolved
@ymansurozer Thanks, I used the same method as you described but the source_nodes object has similarity=None ?
cc: @jerryjliu
@abhishek22-ai can you share your code?
Is there a way to do similarity search without querying index ? For eg: I have ListIndex with text and embeddings I have query_str with its embeddings Now, I just want to get the cosine score between query_str and ListIndex ?
yes see above https://github.com/jerryjliu/gpt_index/issues/466#issuecomment-1436096393
@jerryjliu Hi, What might be reason behind getting similarity=None in response object ? Thanks