mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-03 11:47:49 +00:00
DeepLake Backwards compatibility fix (#13388)
- **Description:** during search with DeepLake some people are facing backwards compatibility issues, this PR fixes it by making search accessible for the older datasets --------- Co-authored-by: adolkhan <adilkhan.sarsen@alumni.nu.edu.kz>
This commit is contained in:
parent
190952fe76
commit
10418ab0c1
@ -413,7 +413,7 @@ class DeepLake(VectorStore):
|
|||||||
distance_metric=distance_metric,
|
distance_metric=distance_metric,
|
||||||
filter=filter,
|
filter=filter,
|
||||||
exec_option=exec_option,
|
exec_option=exec_option,
|
||||||
return_tensors=["embedding", "metadata", "text", "id"],
|
return_tensors=["embedding", "metadata", "text", self._id_tensor_name],
|
||||||
deep_memory=deep_memory,
|
deep_memory=deep_memory,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -259,3 +259,25 @@ def test_add_texts(deeplake_datastore: DeepLake) -> None:
|
|||||||
texts=texts,
|
texts=texts,
|
||||||
metada=metadatas,
|
metada=metadatas,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_ids_backwards_compatibility() -> None:
|
||||||
|
"""Test that ids are backwards compatible."""
|
||||||
|
db = DeepLake(
|
||||||
|
dataset_path="mem://test_path",
|
||||||
|
embedding_function=FakeEmbeddings(),
|
||||||
|
tensor_params=[
|
||||||
|
{"name": "ids", "htype": "text"},
|
||||||
|
{"name": "text", "htype": "text"},
|
||||||
|
{"name": "embedding", "htype": "embedding"},
|
||||||
|
{"name": "metadata", "htype": "json"},
|
||||||
|
],
|
||||||
|
)
|
||||||
|
db.vectorstore.add(
|
||||||
|
ids=["1", "2", "3"],
|
||||||
|
text=["foo", "bar", "baz"],
|
||||||
|
embedding=FakeEmbeddings().embed_documents(["foo", "bar", "baz"]),
|
||||||
|
metadata=[{"page": str(i)} for i in range(3)],
|
||||||
|
)
|
||||||
|
output = db.similarity_search("foo", k=1)
|
||||||
|
assert len(output) == 1
|
||||||
|
Loading…
Reference in New Issue
Block a user