Skip to content

Commit ea61302

Browse files
authored
community[patch]: bug fix - add empty metadata when metadata not provided (langchain-ai#17669)
Code fix to include empty medata dictionary to aadd_texts if metadata is not provided.
1 parent 919ebcc commit ea61302

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libs/community/langchain_community/vectorstores/surrealdb.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ async def aadd_texts(
116116
data = {"text": text, "embedding": embeddings[idx]}
117117
if metadatas is not None and idx < len(metadatas):
118118
data["metadata"] = metadatas[idx] # type: ignore[assignment]
119+
else:
120+
data["metadata"] = []
119121
record = await self.sdb.create(
120122
self.collection,
121123
data,

0 commit comments

Comments
 (0)