@@ -204,7 +204,7 @@ def run(self, retrieved_documents: list[Document], window_size: Optional[int] =
204204
205205 """
206206 window_size = window_size or self .window_size
207- self ._raise_if_windows_size_is_negative (window_size )
207+ SentenceWindowRetriever ._raise_if_windows_size_is_negative (window_size )
208208 self ._raise_if_documents_do_not_have_expected_metadata (retrieved_documents )
209209
210210 context_text = []
@@ -237,7 +237,7 @@ async def run_async(self, retrieved_documents: list[Document], window_size: Opti
237237
238238 """
239239 window_size = window_size or self .window_size
240- self ._raise_if_windows_size_is_negative (window_size )
240+ SentenceWindowRetriever ._raise_if_windows_size_is_negative (window_size )
241241 self ._raise_if_documents_do_not_have_expected_metadata (retrieved_documents )
242242
243243 context_text = []
@@ -249,7 +249,8 @@ async def run_async(self, retrieved_documents: list[Document], window_size: Opti
249249
250250 return {"context_windows" : context_text , "context_documents" : context_documents }
251251
252- def _raise_if_windows_size_is_negative (self , window_size : int ) -> None :
252+ @staticmethod
253+ def _raise_if_windows_size_is_negative (window_size : int ) -> None :
253254 if window_size < 1 :
254255 raise ValueError ("The window_size parameter must be greater than 0." )
255256
@@ -278,7 +279,7 @@ def _retrieve_context_for_document(self, doc: Document, window_size: int) -> tup
278279 source_id = self ._source_id_meta_fields ,
279280 split_id = self .split_id_meta_field ,
280281 )
281- return ( doc .content or "" , [doc ])
282+ return doc .content or "" , [doc ]
282283
283284 assert split_id is not None
284285 filter_conditions = self ._build_filter_conditions (split_id , window_size , source_ids )
@@ -300,7 +301,7 @@ async def _retrieve_context_for_document_async(self, doc: Document, window_size:
300301 source_id = self ._source_id_meta_fields ,
301302 split_id = self .split_id_meta_field ,
302303 )
303- return ( doc .content or "" , [doc ])
304+ return doc .content or "" , [doc ]
304305
305306 assert split_id is not None
306307 filter_conditions = self ._build_filter_conditions (split_id , window_size , source_ids )
0 commit comments