Skip to content

Commit

Permalink
small improvments (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsbatista authored Feb 19, 2024
1 parent 40b794b commit 5bee1e9
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
"""
Expand All @@ -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
"""
Expand Down

0 comments on commit 5bee1e9

Please sign in to comment.