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

Code fix to include empty medata dictionary to aadd_texts if metadata is
not provided.
This commit is contained in:
Karim Lalani 2024-02-19 12:54:52 -06:00 committed by GitHub
parent 919ebcc596
commit ea61302f71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,