Skip to content

fix: AmazonBedRockRanker reordered the top_k fallback to happen after validation - #3748

Open
davidsbatista wants to merge 1 commit into
mainfrom
fix/amazon-bedrock-ranker-top-k-zero
Open

fix: AmazonBedRockRanker reordered the top_k fallback to happen after validation#3748
davidsbatista wants to merge 1 commit into
mainfrom
fix/amazon-bedrock-ranker-top-k-zero

Conversation

@davidsbatista

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

  • Added missing init-time top_k <= 0 validation.
  • Reordered run()'s runtime validation before the fallback.

How did you test it?

  • Added init boundary tests (0, -1), a runtime top_k=0 test, and the fallback-swallow regression test (top_k=5 at init, top_k=0 at runtime must raise, not silently return 5 results).

Checklist

@github-actions github-actions Bot added integration:amazon-bedrock type:documentation Improvements or additions to documentation labels Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Coverage report (amazon_bedrock)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/amazon_bedrock/src/haystack_integrations/components/rankers/amazon_bedrock
  ranker.py
Project Total  

This report was generated by python-coverage-comment-action

@davidsbatista davidsbatista changed the title fix AmazonBedRockRanker reordered the top_k fallback to happen after validation fix: AmazonBedRockRanker reordered the top_k fallback to happen after validation Aug 10, 2026
@davidsbatista
davidsbatista marked this pull request as ready for review August 10, 2026 08:43
@davidsbatista
davidsbatista requested a review from a team as a code owner August 10, 2026 08:43
@davidsbatista
davidsbatista requested review from anakin87 and removed request for a team August 10, 2026 08:43
ranker.run(query="q", documents=[Document(content="x")], top_k=0)


def test_amazon_bedrock_ranker_run_zero_top_k_does_not_fall_back_to_instance_top_k(mock_aws_session):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already verified by the previous tests.
Same as #3745 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:amazon-bedrock type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants