The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Use SQLAlchemy's `bulk_save_objects` method to improve insert performance (#16244)
Andreas Motl3613d8a2ad7f
diff --git a/libs/community/langchain_community/vectorstores/pgvector.py b/libs/community/langchain_community/vectorstores/pgvector.pyindex 7fed642c45..eff9fac354 100644--- a/libs/community/langchain_community/vectorstores/pgvector.py+++ b/libs/community/langchain_community/vectorstores/pgvector.py@@ -379,6 +379,7 @@ class PGVector(VectorStore):collection = self.get_collection(session)if not collection:raise ValueError("Collection not found")+ documents = []for text, metadata, embedding, id in zip(texts, metadatas, embeddings, ids):embedding_store = self.EmbeddingStore(embedding=embedding,@@ -387,7 +388,8 @@ class PGVector(VectorStore):custom_id=id,collection_id=collection.uuid,)- session.add(embedding_store)+ documents.append(embedding_store)+ session.bulk_save_objects(documents)session.commit()return ids