Merge pull request #13232

* PGVector needs to close its connection if its garbage collected
This commit is contained in:
Sumukh Sridhara 2023-11-15 12:34:37 -08:00 committed by GitHub
parent 85a77d2c27
commit 1726d5dcdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,6 +147,10 @@ class PGVector(VectorStore):
self.create_tables_if_not_exists()
self.create_collection()
def __del__(self) -> None:
if self._conn:
self._conn.close()
@property
def embeddings(self) -> Embeddings:
return self.embedding_function