diff --git a/libs/community/langchain_community/vectorstores/pgvector.py b/libs/community/langchain_community/vectorstores/pgvector.py index af0f9ad32ff..7a8a49bc48d 100644 --- a/libs/community/langchain_community/vectorstores/pgvector.py +++ b/libs/community/langchain_community/vectorstores/pgvector.py @@ -455,7 +455,7 @@ class PGVector(VectorStore): return self.CollectionStore.get_by_name(session, self.collection_name) @classmethod - def __from( + def _from( cls, texts: List[str], embeddings: List[List[float]], @@ -623,7 +623,7 @@ class PGVector(VectorStore): k: int = 4, filter: Optional[dict] = None, ) -> List[Tuple[Document, float]]: - results = self.__query_collection(embedding=embedding, k=k, filter=filter) + results = self._query_collection(embedding=embedding, k=k, filter=filter) return self._results_to_docs_and_scores(results) @@ -922,7 +922,7 @@ class PGVector(VectorStore): f"Invalid type: Expected a dictionary but got type: {type(filters)}" ) - def __query_collection( + def _query_collection( self, embedding: List[float], k: int = 4, @@ -1008,7 +1008,7 @@ class PGVector(VectorStore): """ embeddings = embedding.embed_documents(list(texts)) - return cls.__from( + return cls._from( texts, embeddings, embedding, @@ -1054,7 +1054,7 @@ class PGVector(VectorStore): texts = [t[0] for t in text_embeddings] embeddings = [t[1] for t in text_embeddings] - return cls.__from( + return cls._from( texts, embeddings, embedding, @@ -1218,7 +1218,7 @@ class PGVector(VectorStore): List[Tuple[Document, float]]: List of Documents selected by maximal marginal relevance to the query and score for each. """ - results = self.__query_collection(embedding=embedding, k=fetch_k, filter=filter) + results = self._query_collection(embedding=embedding, k=fetch_k, filter=filter) embedding_list = [result.EmbeddingStore.embedding for result in results]