Skip to content

Commit bec822c

Browse files
agnieszka-mdfokina
andauthored
Docs: Update FilterRetriever docstrings (#8133)
* update docstrings * Update haystack/components/retrievers/filter_retriever.py Co-authored-by: Daria Fokina <[email protected]> --------- Co-authored-by: Daria Fokina <[email protected]>
1 parent 25d3520 commit bec822c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

haystack/components/retrievers/filter_retriever.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class FilterRetriever:
1616
"""
1717
Retrieves documents that match the provided filters.
1818
19-
Usage example:
19+
### Usage example
20+
2021
```python
2122
from haystack import Document
2223
from haystack.components.retrievers import FilterRetriever
@@ -31,7 +32,7 @@ class FilterRetriever:
3132
doc_store.write_documents(docs)
3233
retriever = FilterRetriever(doc_store, filters={"field": "lang", "operator": "==", "value": "en"})
3334
34-
# if passed in the run method, filters will override those provided at initialization
35+
# if passed in the run method, filters override those provided at initialization
3536
result = retriever.run(filters={"field": "lang", "operator": "==", "value": "de"})
3637
3738
print(result["documents"])
@@ -43,7 +44,7 @@ def __init__(self, document_store: DocumentStore, filters: Optional[Dict[str, An
4344
Create the FilterRetriever component.
4445
4546
:param document_store:
46-
An instance of a DocumentStore.
47+
An instance of a Document Store to use with the Retriever.
4748
:param filters:
4849
A dictionary with filters to narrow down the search space.
4950
"""
@@ -98,8 +99,8 @@ def run(self, filters: Optional[Dict[str, Any]] = None):
9899
99100
:param filters:
100101
A dictionary with filters to narrow down the search space.
101-
If not specified, the FilterRetriever uses the value provided at initialization.
102+
If not specified, the FilterRetriever uses the values provided at initialization.
102103
:returns:
103-
The retrieved documents.
104+
A list of retrieved documents.
104105
"""
105106
return {"documents": self.document_store.filter_documents(filters=filters or self.filters)}

0 commit comments

Comments
 (0)