community[patch]: update copy of metadata in rockset vectorstore integration (#17612)

- **Description:** This fixes an issue with working with RecordManager.
RecordManager was generating new hashes on documents because `add_texts`
was modifying the metadata directly. Additionally moved some tests to
unit tests since that was a more appropriate home.
- **Issue:** N/A
- **Dependencies:** N/A
- **Twitter handle:** `@_morgan_adams_`
This commit is contained in:
morgana
2024-02-15 22:13:40 -08:00
committed by GitHub
parent c8d96f30bd
commit 9d7ca7df6e
2 changed files with 63 additions and 47 deletions

View File

@@ -1,6 +1,7 @@
from __future__ import annotations
import logging
from copy import deepcopy
from enum import Enum
from typing import Any, Iterable, List, Optional, Tuple
@@ -123,7 +124,7 @@ class Rockset(VectorStore):
batch = []
doc = {}
if metadatas and len(metadatas) > i:
doc = metadatas[i]
doc = deepcopy(metadatas[i])
if ids and len(ids) > i:
doc["_id"] = ids[i]
doc[self._text_key] = text