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 run_batch for standard pipelines #2595

Merged
merged 6 commits into from
May 27, 2022
Merged

Conversation

bogdankostic
Copy link
Contributor

In #2481, we added the possibility to run batches of queries through a Pipeline. This PR adds makes this possible also for standard pipelines by adding run_batch methods.

@bogdankostic bogdankostic marked this pull request as ready for review May 24, 2022 15:59
Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

Looks very good to me already! 👍 The only change I would like to see made is in RetrieverQuestionGenerationPipeline. Both run and run_batch have the same code. So I'd argue that run should call run_batch internally instead of duplicating the code. What do you think?

@@ -495,3 +563,21 @@ def run(self, document_ids: List[str], top_k: int = 5):

self.document_store.return_embedding = False # type: ignore
return similar_documents

def run_batch(self, document_ids: List[str], top_k: int = 5): # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

the code of run_batch is exactly the same as for run here. So I'd say it's better to call run from within run_batch and avoid code duplication.

Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@bogdankostic bogdankostic merged commit 0395533 into master May 27, 2022
@bogdankostic bogdankostic deleted the run_batch_standard_pipelines branch May 27, 2022 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants