Repository: deepset-ai/haystack

Issue:
Docstrings - `haystack.document_stores`



Discussion:

Resolving patch:
diff --git a/haystack/document_stores/in_memory/document_store.py b/haystack/document_stores/in_memory/document_store.py
--- a/haystack/document_stores/in_memory/document_store.py
+++ b/haystack/document_stores/in_memory/document_store.py
@@ -63,7 +63,10 @@ def __init__(
 
     def to_dict(self) -> Dict[str, Any]:
         """
-        Serializes this store to a dictionary.
+        Serializes the component to a dictionary.
+
+        :returns:
+            Dictionary with serialized data.
         """
         return default_to_dict(
             self,
@@ -76,7 +79,12 @@ def to_dict(self) -> Dict[str, Any]:
     @classmethod
     def from_dict(cls, data: Dict[str, Any]) -> "InMemoryDocumentStore":
         """
-        Deserializes the store from a dictionary.
+        Deserializes the component from a dictionary.
+
+        :param data:
+            The dictionary to deserialize from.
+        :returns:
+            The deserialized component.
         """
         return default_from_dict(cls, data)
 
@@ -93,7 +101,7 @@ def filter_documents(self, filters: Optional[Dict[str, Any]] = None) -> List[Doc
         For a detailed specification of the filters, refer to the DocumentStore.filter_documents() protocol documentation.
 
         :param filters: The filters to apply to the document list.
-        :return: A list of Documents that match the given filters.
+        :returns: A list of Documents that match the given filters.
         """
         if filters:
             if "operator" not in filters and "conditions" not in filters:
@@ -132,7 +140,7 @@ def write_documents(self, documents: List[Document], policy: DuplicatePolicy = D
     def delete_documents(self, document_ids: List[str]) -> None:
         """
         Deletes all documents with matching document_ids from the DocumentStore.
-        :param object_ids: The object_ids to delete.
+        :param document_ids: The object_ids to delete.
         """
         for doc_id in document_ids:
             if doc_id not in self.storage.keys():
@@ -149,7 +157,7 @@ def bm25_retrieval(
         :param filters: A dictionary with filters to narrow down the search space.
         :param top_k: The number of top documents to retrieve. Default is 10.
         :param scale_score: Whether to scale the scores of the retrieved documents. Default is False.
-        :return: A list of the top_k documents most relevant to the query.
+        :returns: A list of the top_k documents most relevant to the query.
         """
         if not query:
             raise ValueError("Query should be a non-empty string")
@@ -242,7 +250,7 @@ def embedding_retrieval(
         :param top_k: The number of top documents to retrieve. Default is 10.
         :param scale_score: Whether to scale the scores of the retrieved Documents. Default is False.
         :param return_embedding: Whether to return the embedding of the retrieved Documents. Default is False.
-        :return: A list of the top_k documents most relevant to the query.
+        :returns: A list of the top_k documents most relevant to the query.
         """
         if len(query_embedding) == 0 or not isinstance(query_embedding[0], float):
             raise ValueError("query_embedding should be a non-empty list of floats.")
@@ -287,7 +295,7 @@ def _compute_query_embedding_similarity_scores(
         :param embedding: Embedding of the query.
         :param documents: A list of Documents.
         :param scale_score: Whether to scale the scores of the Documents. Default is False.
-        :return: A list of scores.
+        :returns: A list of scores.
         """
 
         query_embedding = np.array(embedding)
diff --git a/haystack/document_stores/types/protocol.py b/haystack/document_stores/types/protocol.py
--- a/haystack/document_stores/types/protocol.py
+++ b/haystack/document_stores/types/protocol.py
@@ -105,7 +105,7 @@ def filter_documents(self, filters: Optional[Dict[str, Any]] = None) -> List[Doc
         }
 
         :param filters: the filters to apply to the document list.
-        :return: a list of Documents that match the given filters.
+        :returns: a list of Documents that match the given filters.
         """
         ...
 
@@ -120,7 +120,7 @@ def write_documents(self, documents: List[Document], policy: DuplicatePolicy = D
             - `DuplicatePolicy.OVERWRITE`: If a Document with the same id already exists, it is overwritten.
             - `DuplicatePolicy.FAIL`: If a Document with the same id already exists, an error is raised.
         :raises DuplicateError: If `policy` is set to `DuplicatePolicy.FAIL` and a Document with the same id already exists.
-        :return: The number of Documents written.
+        :returns: The number of Documents written.
             If `DuplicatePolicy.OVERWRITE` is used, this number is always equal to the number of documents in input.
             If `DuplicatePolicy.SKIP` is used, this number can be lower than the number of documents in the input list.
         """
@@ -129,8 +129,9 @@ def write_documents(self, documents: List[Document], policy: DuplicatePolicy = D
     def delete_documents(self, document_ids: List[str]) -> None:
         """
         Deletes all documents with a matching document_ids from the DocumentStore.
+
         Fails with `MissingDocumentError` if no document with this id is present in the DocumentStore.
 
-        :param object_ids: the object_ids to delete
+        :param document_ids: the object_ids to delete
         """
         ...


Test patch: