Skip to content

Commit

Permalink
fixing internal methods
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsbatista committed Dec 9, 2024
1 parent 520a457 commit e547e16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion haystack/components/rankers/meta_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ def __init__( # pylint: disable=too-many-positional-arguments
)
self.meta_value_type = meta_value_type

def _validate_params( # pylint: disable=too-many-positional-arguments
def _validate_params(
self,
*,
weight: float,
top_k: Optional[int],
ranking_mode: Literal["reciprocal_rank_fusion", "linear_score"],
Expand Down
7 changes: 5 additions & 2 deletions haystack/components/readers/extractive.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ def warm_up(self):
)
self.device = ComponentDevice.from_multiple(device_map=DeviceMap.from_hf(self.model.hf_device_map))

@staticmethod
def _flatten_documents(
self, queries: List[str], documents: List[List[Document]]
queries: List[str], documents: List[List[Document]]
) -> Tuple[List[str], List[Document], List[int]]:
"""
Flattens queries and Documents so all query-document pairs are arranged along one batch axis.
Expand Down Expand Up @@ -594,7 +595,9 @@ def run( # pylint: disable=too-many-positional-arguments
no_answer = no_answer if no_answer is not None else self.no_answer
overlap_threshold = overlap_threshold or self.overlap_threshold

flattened_queries, flattened_documents, query_ids = self._flatten_documents(queries, nested_documents)
flattened_queries, flattened_documents, query_ids = ExtractiveReader._flatten_documents(
queries, nested_documents
)
input_ids, attention_mask, sequence_ids, encodings, query_ids, document_ids = self._preprocess(
flattened_queries, flattened_documents, max_seq_length, query_ids, stride
)
Expand Down

0 comments on commit e547e16

Please sign in to comment.