|
4 | 4 |
|
5 | 5 | from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
|
6 | 6 |
|
7 |
| -from haystack import Pipeline, default_from_dict, default_to_dict, logging, super_component |
| 7 | +from haystack import Document, Pipeline, component, default_from_dict, default_to_dict, logging, super_component |
8 | 8 | from haystack.components.embedders.types import TextEmbedder
|
9 | 9 | from haystack.components.joiners import DocumentJoiner
|
10 | 10 | from haystack.components.joiners.document_joiner import JoinMode
|
@@ -239,8 +239,6 @@ def __init__(
|
239 | 239 |
|
240 | 240 | def warm_up(self) -> None: ...
|
241 | 241 |
|
242 |
| - def run(self, query: str, filters_bm25=None, filters_embedding=None) -> Dict[str, Any]: ... |
243 |
| - |
244 | 242 | def _create_pipeline(self, data: dict[str, Any]) -> Pipeline:
|
245 | 243 | """
|
246 | 244 | Create the pipeline for the OpenSearchHybridRetriever.
|
@@ -325,3 +323,15 @@ def from_dict(cls, data):
|
325 | 323 | data["init_parameters"]["join_mode"] = join_mode
|
326 | 324 |
|
327 | 325 | return default_from_dict(cls, data)
|
| 326 | + |
| 327 | + @component.output_types(documents=List[Document]) |
| 328 | + def run( |
| 329 | + self, |
| 330 | + query: str, |
| 331 | + filters_bm25: Optional[Dict[str, Any]] = None, |
| 332 | + filters_embedding: Optional[Dict[str, Any]] = None, |
| 333 | + **kwargs: Any, # noqa |
| 334 | + ): |
| 335 | + # Technically not necessary to override this method |
| 336 | + # We only do it to have input/output types immediately available |
| 337 | + super().run(query=query, filters_bm25=filters_bm25, filters_embedding=filters_embedding) # type: ignore |
0 commit comments