From 61856e64aed68795831a62288b28a9506dec2901 Mon Sep 17 00:00:00 2001 From: lspataroG <167472995+lspataroG@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:26:24 +0100 Subject: [PATCH] Fixing datastore limitation indexing large fields in metadata (#582) --- .../vectorstores/document_storage.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/vertexai/langchain_google_vertexai/vectorstores/document_storage.py b/libs/vertexai/langchain_google_vertexai/vectorstores/document_storage.py index 27e9e5ab..bfaa5cf8 100644 --- a/libs/vertexai/langchain_google_vertexai/vectorstores/document_storage.py +++ b/libs/vertexai/langchain_google_vertexai/vectorstores/document_storage.py @@ -294,8 +294,12 @@ def mset(self, key_value_pairs: Sequence[Tuple[str, Document]]) -> None: entity = self._client.entity( key=key, exclude_from_indexes=self.exclude_from_indexes ) + metadata_entity = self._client.entity( + exclude_from_indexes=self.exclude_from_indexes + ) + metadata_entity.update(document.metadata) entity[self._text_property_name] = document.page_content - entity[self._metadata_property_name] = document.metadata + entity[self._metadata_property_name] = metadata_entity entities.append(entity) self._client.put_multi(entities)