From 5bee1e9063944bb8eed24c4e056247ccdd8e2dbb Mon Sep 17 00:00:00 2001 From: "David S. Batista" Date: Mon, 19 Feb 2024 17:33:37 +0100 Subject: [PATCH] small improvments (#443) --- .../document_stores/chroma/document_store.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py b/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py index 4c0b3c480..3249ec4f8 100644 --- a/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py +++ b/integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py @@ -35,7 +35,7 @@ def __init__( and the signature can be customized to your needs. For example, parameters needed to set up a database client would be passed to this method. - Note: for the component to be part of a serializable pipelie, the __init__ + Note: for the component to be part of a serializable pipeline, the __init__ parameters must be serializable, reason why we use a registry to configure the embedding function passing a string. """ @@ -179,7 +179,7 @@ def delete_documents(self, document_ids: List[str]) -> None: Deletes all documents with a matching document_ids from the document store. Fails with `MissingDocumentError` if no document with this id is present in the store. - :param object_ids: the object_ids to delete + :param document_ids: the object_ids to delete """ self._collection.delete(ids=document_ids) @@ -230,7 +230,8 @@ def to_dict(self) -> Dict[str, Any]: **self._embedding_function_params, } - def _normalize_filters(self, filters: Dict[str, Any]) -> Tuple[List[str], Dict[str, Any], Dict[str, Any]]: + @staticmethod + def _normalize_filters(filters: Dict[str, Any]) -> Tuple[List[str], Dict[str, Any], Dict[str, Any]]: """ Translate Haystack filters to Chroma filters. It returns three dictionaries, to be passed to `ids`, `where` and `where_document` respectively. @@ -284,7 +285,8 @@ def _normalize_filters(self, filters: Dict[str, Any]) -> Tuple[List[str], Dict[s return ids, final_where, where_document - def _get_result_to_documents(self, result: GetResult) -> List[Document]: + @staticmethod + def _get_result_to_documents(result: GetResult) -> List[Document]: """ Helper function to convert Chroma results into Haystack Documents """ @@ -309,7 +311,8 @@ def _get_result_to_documents(self, result: GetResult) -> List[Document]: return retval - def _query_result_to_documents(self, result: QueryResult) -> List[List[Document]]: + @staticmethod + def _query_result_to_documents(result: QueryResult) -> List[List[Document]]: """ Helper function to convert Chroma results into Haystack Documents """