Issue: Pinecone Vector Store incorrectly assigns score in similarity_search_with_relevance_scores #12697
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
🔌: pinecone
Primarily related to Pinecone vector store integration
Ɑ: vector store
Related to vector store module
Issue you'd like to raise.
With the Pinecone index setup with
cosine
metric, so the scores received from the vector database are already in thecosine
metric.However, the
_select_relevance_score_fn
of langchain pinecone vector store returns the base vector store's_cosine_relevance_score_fn
for thecosine
distance strategy.langchain/libs/langchain/langchain/vectorstores/pinecone.py
Line 231 in b213850
In the base vector store implementation of
_cosine_relevance_score_fn
the score is the complement.https://github.com/langchain-ai/langchain/blob/master/libs/langchain/langchain/schema/vectorstore.py#L187
So the cosine metric of 0.81 returned by the pinecone vector database indicating a higher similarity is turned into 0.19 in langchain and processed as very low similarity.
Suggestion:
No response
The text was updated successfully, but these errors were encountered: