Skip to content

Commit

Permalink
fixing types and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsbatista committed Dec 3, 2024
1 parent 98ed92e commit e68aac3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions haystack/components/retrievers/sentence_window_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def from_dict(cls, data: Dict[str, Any]) -> "SentenceWindowRetriever":
# deserialize the component
return default_from_dict(cls, data)

@component.output_types(context_windows=List[str], context_documents=List[List[Document]])
@component.output_types(context_windows=List[str], context_documents=List[Document])
def run(self, retrieved_documents: List[Document], window_size: Optional[int] = None):
"""
Based on the `source_id` and on the `doc.meta['split_id']` get surrounding documents from the document store.
Expand All @@ -158,9 +158,9 @@ def run(self, retrieved_documents: List[Document], window_size: Optional[int] =
A dictionary with the following keys:
- `context_windows`: A list of strings, where each string represents the concatenated text from the
context window of the corresponding document in `retrieved_documents`.
- `context_documents`: A list of lists of `Document` objects, where each inner list contains the
documents that come from the context window for the corresponding document in
`retrieved_documents`.
- `context_documents`: A list `Document` objects, containing the retrieved documents plus the context
document surrounding them. The documents are sorted by the `split_idx_start`
meta field.
"""
window_size = window_size or self.window_size
Expand Down

0 comments on commit e68aac3

Please sign in to comment.