Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Improve imports for new rankers #5696

Merged
merged 2 commits into from
Aug 31, 2023
Merged

fix: Improve imports for new rankers #5696

merged 2 commits into from
Aug 31, 2023

Conversation

vblagoje
Copy link
Member

@vblagoje vblagoje commented Aug 31, 2023

Why:

The PR aims to standardize how new rankers: RecentnessRanker, DiversityRanker, and LostInTheMiddleRanker are imported in Haystack. Currently, these rankers are inconsistently imported compared to existing rankers. By modifying haystack/nodes/ranker/__init__.py, we make it possible for users to import these rankers in a manner consistent with existing ones.

What:

Updated haystack/nodes/ranker/__init__.py to include the new rankers and also updated examples to reflect this change.

How can it be used:

After this change, users can import the new rankers as shown below, which is consistent with how existing rankers are imported:

from haystack.nodes.ranker import DiversityRanker, LostInTheMiddleRanker, RecentnessRanker

How did you test it:

Manually tested the new import paths in the haystack/examples directory to ensure they work as expected.

Notes For Reviewer:

Please double-check the examples on this branch to ensure that the new import paths are correctly implemented and that there are no unintended side effects.

@vblagoje vblagoje added this to the 1.20.0 milestone Aug 31, 2023
@vblagoje vblagoje requested a review from a team as a code owner August 31, 2023 08:01
@vblagoje vblagoje requested review from masci and removed request for a team August 31, 2023 08:01
@vblagoje vblagoje added the ignore-for-release-notes PRs with this flag won't be included in the release notes. label Aug 31, 2023
@coveralls
Copy link
Collaborator

coveralls commented Aug 31, 2023

Pull Request Test Coverage Report for Build 6034651418

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.002%) to 48.527%

Files with Coverage Reduction New Missed Lines %
utils/context_matching.py 1 95.7%
Totals Coverage Status
Change from base Build 6028221935: 0.002%
Covered Lines: 11564
Relevant Lines: 23830

💛 - Coveralls

@ZanSara ZanSara merged commit 6787ad2 into main Aug 31, 2023
52 of 53 checks passed
@ZanSara ZanSara deleted the rankers_import branch August 31, 2023 11:33
vblagoje added a commit that referenced this pull request Aug 31, 2023
* Proper imports for new rankers

* Small fix
@vblagoje
Copy link
Member Author

Cherry-picked to https://github.com/deepset-ai/haystack/tree/v1.20.x as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore-for-release-notes PRs with this flag won't be included in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants