Skip to content

Commit 5788f75

Browse files
authored
Fix: #720 - Preserve sparse_embeddings in data_points_to_batch_update_records function (#721)
1 parent af08759 commit 5788f75

File tree

1 file changed

+9
-0
lines changed
  • libs/vertexai/langchain_google_vertexai/vectorstores

1 file changed

+9
-0
lines changed

libs/vertexai/langchain_google_vertexai/vectorstores/_utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@ def data_points_to_batch_update_records(
170170
],
171171
}
172172

173+
if (
174+
hasattr(data_point, "sparse_embedding")
175+
and data_point.sparse_embedding is not None
176+
):
177+
record["sparse_embedding"] = {
178+
"values": [value for value in data_point.sparse_embedding.values],
179+
"dimensions": [dim for dim in data_point.sparse_embedding.dimensions],
180+
}
181+
173182
records.append(record)
174183

175184
return records

0 commit comments

Comments
 (0)