[AUR-430] Add test case for Chroma VectoStore save/load (#26)
* add test case for Chroma save/load * minor name change * add delete_collection support for chroma * move save load to chroma --------- Co-authored-by: Nguyen Trung Duc (john) <john@cinnamon.is>
This commit is contained in:
committed by
GitHub
parent
4f189dc931
commit
6207f4332a
@@ -53,19 +53,6 @@ class BaseVectorStore(ABC):
|
||||
"""
|
||||
...
|
||||
|
||||
# @abstractmethod
|
||||
# def update(self, *args, **kwargs):
|
||||
# ...
|
||||
|
||||
# @abstractmethod
|
||||
# def persist(self, *args, **kwargs):
|
||||
# ...
|
||||
|
||||
# @classmethod
|
||||
# @abstractmethod
|
||||
# def load(self, *args, **kwargs):
|
||||
# ...
|
||||
|
||||
@abstractmethod
|
||||
def query(
|
||||
self,
|
||||
@@ -85,6 +72,14 @@ class BaseVectorStore(ABC):
|
||||
"""
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
def load(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def save(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class LlamaIndexVectorStore(BaseVectorStore):
|
||||
_li_class: Type[Union[LIVectorStore, BasePydanticVectorStore]]
|
||||
|
@@ -54,3 +54,21 @@ class ChromaVectorStore(LlamaIndexVectorStore):
|
||||
kwargs: meant for vectorstore-specific parameters
|
||||
"""
|
||||
self._client._collection.delete(ids=ids)
|
||||
|
||||
def delete_collection(self, collection_name: Optional[str] = None):
|
||||
"""Delete entire collection under specified name from vector stores
|
||||
|
||||
Args:
|
||||
collection_name: Name of the collection to delete
|
||||
"""
|
||||
# a rather ugly chain call but it do the job of finding
|
||||
# original chromadb client and call delete_collection() method
|
||||
if collection_name is None:
|
||||
collection_name = self._client.client.name
|
||||
self._client.client._client.delete_collection(collection_name)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def load(self, *args, **kwargs):
|
||||
pass
|
||||
|
Reference in New Issue
Block a user