From 76ae9da9db55230d92db6cd9daaba7706bd997b4 Mon Sep 17 00:00:00 2001 From: Wenchen Li <9028430+neo@users.noreply.github.com> Date: Tue, 20 Jun 2023 12:36:40 +0800 Subject: [PATCH] Add `_similarity_search_with_relevance_scores` in `Pinecone` (#6446) Just so it is consistent with other `VectorStore` classes. This is a follow-up of #6056 which also discussed the potential of adding `similarity_search_by_vector_returning_embeddings` that we will continue the discussion here. potentially related: #6286 #### Who can review? Tag maintainers/contributors who might be interested: @rlancemartin --- langchain/vectorstores/pinecone.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/langchain/vectorstores/pinecone.py b/langchain/vectorstores/pinecone.py index 48ec6128..d34264dd 100644 --- a/langchain/vectorstores/pinecone.py +++ b/langchain/vectorstores/pinecone.py @@ -160,6 +160,14 @@ class Pinecone(VectorStore): ) return [doc for doc, _ in docs_and_scores] + def _similarity_search_with_relevance_scores( + self, + query: str, + k: int = 4, + **kwargs: Any, + ) -> List[Tuple[Document, float]]: + return self.similarity_search_with_score(query, k) + def max_marginal_relevance_search_by_vector( self, embedding: List[float],