mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-26 00:23:25 +00:00
Bagatur/pinecone by vector (#9087)
Co-authored-by: joseph <joe@outverse.com>
This commit is contained in:
parent
6abb2c2c08
commit
b80e3825a6
@ -142,12 +142,25 @@ class Pinecone(VectorStore):
|
||||
Returns:
|
||||
List of Documents most similar to the query and score for each
|
||||
"""
|
||||
return self.similarity_search_by_vector_with_score(
|
||||
self._embed_query(query), k=k, filter=filter, namespace=namespace
|
||||
)
|
||||
|
||||
def similarity_search_by_vector_with_score(
|
||||
self,
|
||||
embedding: List[float],
|
||||
*,
|
||||
k: int = 4,
|
||||
filter: Optional[dict] = None,
|
||||
namespace: Optional[str] = None,
|
||||
) -> List[Tuple[Document, float]]:
|
||||
"""Return pinecone documents most similar to embedding, along with scores."""
|
||||
|
||||
if namespace is None:
|
||||
namespace = self._namespace
|
||||
query_obj = self._embed_query(query)
|
||||
docs = []
|
||||
results = self._index.query(
|
||||
[query_obj],
|
||||
[embedding],
|
||||
top_k=k,
|
||||
include_metadata=True,
|
||||
namespace=namespace,
|
||||
|
Loading…
Reference in New Issue
Block a user