Skip to content

Commit

Permalink
Merge pull request #13232
Browse files Browse the repository at this point in the history
* PGVector needs to close its connection if its garbage collected
  • Loading branch information
Sumukh authored Nov 15, 2023
1 parent 85a77d2 commit 1726d5d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libs/langchain/langchain/vectorstores/pgvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ def __post_init__(
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
Expand Down

0 comments on commit 1726d5d

Please sign in to comment.