Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions haystack/components/joiners/answer_joiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def __init__(
:param top_k:
The maximum number of Answers to return. Must be `None` or greater than 0.
:param sort_by_score:
If `True`, sorts the documents by score in descending order.
If a document has no score, it is handled as if its score is -infinity.
If `True`, sorts the answers by score in descending order.
If an answer has no score, it is handled as if its score is -infinity.

:raises ValueError:
If `top_k` is not `None` and is less than or equal to 0.
Expand Down Expand Up @@ -154,7 +154,7 @@ def run(self, answers: Variadic[list[AnswerType]], top_k: int | None = None) ->

def _concatenate(self, answer_lists: list[list[AnswerType]]) -> list[AnswerType]:
"""
Concatenate multiple lists of Answers, flattening them into a single list and sorting by score.
Concatenate multiple lists of Answers, flattening them into a single list.

:param answer_lists: List of lists of Answers to be flattened.
"""
Expand Down
5 changes: 3 additions & 2 deletions haystack/components/preprocessors/recursive_splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def __init__(

:param split_length: The maximum length of each chunk by default in words, but can be in characters or tokens.
See the `split_units` parameter.
:param split_overlap: The number of characters to overlap between consecutive chunks.
:param split_overlap: The number of overlapping units (words, characters, or tokens, per
`split_unit`) between consecutive chunks.
:param split_unit: The unit of the split_length parameter. It can be either "word", "char", or "token".
If "token" is selected, the text will be split into tokens using the tiktoken tokenizer (o200k_base).
:param separators: An optional list of separator strings to use for splitting the text. The string
Expand Down Expand Up @@ -113,7 +114,7 @@ def _check_params(self) -> None:
if self.split_length < 1:
raise ValueError("Split length must be at least 1 character.")
if self.split_overlap < 0:
raise ValueError("Overlap must be greater than zero.")
raise ValueError("split_overlap must be greater than or equal to 0.")
if self.split_overlap >= self.split_length:
raise ValueError("Overlap cannot be greater than or equal to the chunk size.")
if not all(isinstance(separator, str) for separator in self.separators):
Expand Down
2 changes: 1 addition & 1 deletion haystack/components/rankers/meta_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def run(
:param ranking_mode:
(optional) The mode used to combine the Retriever's and Ranker's scores.
Possible values are 'reciprocal_rank_fusion' (default) and 'linear_score'.
Use the 'score' mode only with Retrievers or Rankers that return a score in range [0,1].
Use the 'linear_score' mode only with Retrievers or Rankers that return a score in range [0,1].
If not provided, the ranking_mode provided at initialization time is used.
:param sort_order:
Whether to sort the meta field by ascending or descending order.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fixes:
- |
Correct the ``split_overlap`` validation message in ``RecursiveDocumentSplitter`` (0 is the
default and only negative values are rejected) and clarify that overlap is measured in
``split_units``. Also fix stale docstrings in ``AnswerJoiner`` (documented parameters the
methods do not take, and claimed sorting that only happens for answers) and the
``meta_field`` ranker (referenced a nonexistent ``score`` mode).
Loading