Skip to content

Commit

Permalink
community[patch]: bug fix - add empty metadata when metadata not prov…
Browse files Browse the repository at this point in the history
…ided (#17669)

Code fix to include empty medata dictionary to aadd_texts if metadata is
not provided.
  • Loading branch information
lalanikarim authored Feb 19, 2024
1 parent 919ebcc commit ea61302
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/community/langchain_community/vectorstores/surrealdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ async def aadd_texts(
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,
Expand Down

0 comments on commit ea61302

Please sign in to comment.