diff --git a/libs/community/langchain_community/vectorstores/chroma.py b/libs/community/langchain_community/vectorstores/chroma.py index 7723285fafa6c..134f2f9acd779 100644 --- a/libs/community/langchain_community/vectorstores/chroma.py +++ b/libs/community/langchain_community/vectorstores/chroma.py @@ -16,6 +16,7 @@ ) import numpy as np +from langchain_core._api import deprecated from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.utils import xor_args @@ -610,11 +611,22 @@ def get( return self._collection.get(**kwargs) + @deprecated( + since="0.1.17", + message=( + "Since Chroma 0.4.x the manual persistence method is no longer " + "supported as docs are automatically persisted." + ), + removal="0.3.0", + ) def persist(self) -> None: """Persist the collection. This can be used to explicitly persist the data to disk. It will also be called automatically when the object is destroyed. + + Since Chroma 0.4.x the manual persistence method is no longer + supported as docs are automatically persisted. """ if self._persist_directory is None: raise ValueError( diff --git a/libs/community/tests/integration_tests/vectorstores/test_chroma.py b/libs/community/tests/integration_tests/vectorstores/test_chroma.py index 0a0cf529d08e6..b6549626a6caf 100644 --- a/libs/community/tests/integration_tests/vectorstores/test_chroma.py +++ b/libs/community/tests/integration_tests/vectorstores/test_chroma.py @@ -136,8 +136,6 @@ def test_chroma_with_persistence() -> None: output = docsearch.similarity_search("foo", k=1) assert output == [Document(page_content="foo")] - docsearch.persist() - # Get a new VectorStore from the persisted directory docsearch = Chroma( collection_name=collection_name,