Skip to content

armgit / mem0

Public Imported from GitHub
0

The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.

fix: add metadata in add and add_local (#343)

juaneloDevaed894246fe8
diff --git a/embedchain/embedchain.py b/embedchain/embedchain.py
index 3c3bd7e9a..6de981a50 100644
--- a/embedchain/embedchain.py
+++ b/embedchain/embedchain.py
@@ -121,7 +121,7 @@ class EmbedChain:
chunks_before_addition = self.count()
# Add metadata to each document
- metadatas_with_metadata = [meta or metadata for meta in metadatas]
+ metadatas_with_metadata = [{**meta, **metadata} for meta in metadatas]
self.collection.add(documents=documents, metadatas=list(metadatas_with_metadata), ids=ids)
print((f"Successfully saved {src}. New chunks count: " f"{self.count() - chunks_before_addition}"))