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

Add top_k_join parameter to JoinDocuments.run #2065

Merged

Conversation

adri1wald
Copy link
Contributor

@adri1wald adri1wald commented Jan 25, 2022

Implements a solution to #2059

Proposed changes:

JoinDocuments.run takes an optional parameter top_k_join that overrides the instance top_k_join of JoinDocuments.

This allows top_k_join to be modified when runing a pipeline, e.g.

p = Pipeline()
p.add_node(component=retriever_1, name="R1", inputs=["Query"])
p.add_node(component=retriever_2, name="R2", inputs=["Query"])
p.add_node(component=JoinDocuments(join_mode="concatenate"), name="Join", inputs=["R1", "R2"])
results = p.run(query=query, params={ 'Join': { 'top_k_join': 1 } })
# len(results["documents"]) == 1

Status (please check what you already did):

  • First draft (up for discussions & feedback)
  • Final code
  • Added tests
  • Updated documentation

@adri1wald adri1wald marked this pull request as draft January 25, 2022 23:36
@ZanSara ZanSara self-requested a review January 26, 2022 08:56
@ZanSara ZanSara linked an issue Jan 26, 2022 that may be closed by this pull request
Copy link
Contributor

@ZanSara ZanSara left a comment

Choose a reason for hiding this comment

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

Hello @adri1wald, neat work! Thanks a lot for the test especially! I left only a comment with an idea to extend it a bit, but this is all looking ready to merge.

Do you think is there anything else to add to this PR? Otherwise once you modify the test and CI is green I'm going to merge 🙂

test/test_standard_pipelines.py Outdated Show resolved Hide resolved
@adri1wald
Copy link
Contributor Author

Hello @adri1wald, neat work! Thanks a lot for the test especially! I left only a comment with an idea to extend it a bit, but this is all looking ready to merge.

Do you think is there anything else to add to this PR? Otherwise once you modify the test and CI is green I'm going to merge 🙂

Hey @ZanSara, great idea to extend the test with two different top_k_join - have made the change!

I think it might be worth adding some info in the documentation? But not sure where the best place is to add it.

@ZanSara
Copy link
Contributor

ZanSara commented Jan 26, 2022

No problem for the documentation, the API docs should update automatically based on the docstring. In any case I will check once this PR is merged, and if necessary I can add a note myself later 👍

@ZanSara ZanSara marked this pull request as ready for review January 26, 2022 14:26
@ZanSara ZanSara merged commit 2edc421 into deepset-ai:master Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:pipeline type:feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make top_k_join overridable when calling JoinDocuments.run
2 participants