Skip to content

feat: add Pyversity integration#2861

Merged
kacperlukawski merged 21 commits intomainfrom
pyversity-integration
Feb 27, 2026
Merged

feat: add Pyversity integration#2861
kacperlukawski merged 21 commits intomainfrom
pyversity-integration

Conversation

@kacperlukawski
Copy link
Copy Markdown
Member

Related Issues

Proposed Changes:

Integrate Pyversity for retrieval results diversification.

How did you test it?

Unit tests are included similarly to the other integrations.

Checklist

@kacperlukawski kacperlukawski requested a review from a team as a code owner February 19, 2026 19:14
@kacperlukawski kacperlukawski requested review from sjrl and removed request for a team February 19, 2026 19:14
@github-actions github-actions Bot added the type:documentation Improvements or additions to documentation label Feb 19, 2026
@sjrl
Copy link
Copy Markdown
Contributor

sjrl commented Feb 20, 2026

@kacperlukawski thanks for the new integration! A few high level comments I want to provide as feedback:

  • We need to add to_dict and from_dict methods to this new component otherwise it won't be possible to configure it via yaml which we use in our cloud platform.
  • I was also wondering is there value in letting k be set to None? My thought would be if set to None then all documents should be returned just reranked using the diversify algorithm. I believe this something we already do in our other rankers as well. What do you think?

Comment thread integrations/pyversity/CHANGELOG.md Outdated
Comment thread integrations/pyversity/LICENSE.txt Outdated
Comment thread integrations/pyversity/pyproject.toml Outdated
@kacperlukawski
Copy link
Copy Markdown
Member Author

@kacperlukawski thanks for the new integration! A few high level comments I want to provide as feedback:

  • We need to add to_dict and from_dict methods to this new component otherwise it won't be possible to configure it via yaml which we use in our cloud platform.
  • I was also wondering is there value in letting k be set to None? My thought would be if set to None then all documents should be returned just reranked using the diversify algorithm. I believe this something we already do in our other rankers as well. What do you think?

Thanks for having a look @sjrl! I added to_dict and from_dict, and allowed setting top_k=None. I noticed the other rerankers modify the score of the documents, so it's also implemented accordingly.

@kacperlukawski kacperlukawski requested a review from sjrl February 23, 2026 13:01
return default_from_dict(cls, data)

@component.output_types(documents=list[Document])
def run(self, documents: list[Document]) -> dict:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you think it would also make sense to expose some of the other params like top_k, strategy or diversity at runtime as well? We often have top_k as a runtime param as well so users can easily test without needing to reinitialize the component or pipeline.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, makes sense if we do that for other components. Let me extend it.

Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@sjrl sjrl left a comment

Choose a reason for hiding this comment

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

Looks good! Up to you if you'd like to expand the run method. We can always do it later if users request it as a feature.

@kacperlukawski
Copy link
Copy Markdown
Member Author

@sjrl I decided to add a way to override all these params in runtime and some tests to cover these cases.

@sjrl
Copy link
Copy Markdown
Contributor

sjrl commented Feb 25, 2026

@sjrl I decided to add a way to override all these params in runtime and some tests to cover these cases.

Looks good, feel free to merge!

@kacperlukawski kacperlukawski merged commit 47441f2 into main Feb 27, 2026
12 checks passed
@kacperlukawski kacperlukawski deleted the pyversity-integration branch February 27, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:pyversity topic:CI type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Pyversity integration

3 participants