diff --git a/comps/retrievers/langchain/pinecone/retriever_pinecone.py b/comps/retrievers/langchain/pinecone/retriever_pinecone.py index d28aea5294..ba8e6526f5 100644 --- a/comps/retrievers/langchain/pinecone/retriever_pinecone.py +++ b/comps/retrievers/langchain/pinecone/retriever_pinecone.py @@ -54,14 +54,10 @@ def retrieve(input: EmbedDoc) -> SearchedDoc: elif input.search_type == "similarity_distance_threshold": if input.distance_threshold is None: raise ValueError("distance_threshold must be provided for " + "similarity_distance_threshold retriever") - docs_and_similarities = vector_db.similarity_search_by_vector_with_score( - embedding=input.embedding, k=input.k - ) + docs_and_similarities = vector_db.similarity_search_by_vector_with_score(embedding=input.embedding, k=input.k) search_res = [doc for doc, similarity in docs_and_similarities if similarity > input.distance_threshold] elif input.search_type == "similarity_score_threshold": - docs_and_similarities = vector_db.similarity_search_by_vector_with_score( - query=input.text, k=input.k - ) + docs_and_similarities = vector_db.similarity_search_by_vector_with_score(query=input.text, k=input.k) search_res = [doc for doc, similarity in docs_and_similarities if similarity > input.score_threshold] elif input.search_type == "mmr": search_res = vector_db.max_marginal_relevance_search(