Skip to content

The agent engineering platform.

community[patch]: bug fix - add empty metadata when metadata not provided (#17669)

Karim Lalaniea61302f71ee
diff --git a/libs/community/langchain_community/vectorstores/surrealdb.py b/libs/community/langchain_community/vectorstores/surrealdb.py
index ef65c5ec6b..34f002305e 100644
--- a/libs/community/langchain_community/vectorstores/surrealdb.py
+++ b/libs/community/langchain_community/vectorstores/surrealdb.py
@@ -116,6 +116,8 @@ class SurrealDBStore(VectorStore):
data = {"text": text, "embedding": embeddings[idx]}
if metadatas is not None and idx < len(metadatas):
data["metadata"] = metadatas[idx] # type: ignore[assignment]
+ else:
+ data["metadata"] = []
record = await self.sdb.create(
self.collection,
data,