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

Lazy Run/Evaluation of components based on downstream necessity #6843

Closed
bglearning opened this issue Jan 29, 2024 · 2 comments
Closed

Lazy Run/Evaluation of components based on downstream necessity #6843

bglearning opened this issue Jan 29, 2024 · 2 comments
Labels
2.x Related to Haystack v2.0 community-triage stale

Comments

@bglearning
Copy link
Contributor

bglearning commented Jan 29, 2024

Came up in #6836

Wondering if there is a way to setup a component to only run if there is a downstream component needing its output.

E.g. Possible usage: the FilterRetriever (which simply runs a preset filter on a document-store) is in one of many optional branches. And we would only want to run it if the branch is followed (e.g. for a certain type of query). I guess this can be generalized to any "inputless" component.

One such setup could be:

filter_branch

Here we'd want the FilterRetriever to run only when necessary (LookupReader needs its output).

Describe alternatives you've considered

  • Could set up the component (here FilterRetriever) to take some "trigger" input.
  • Or just ignore components being run unnecessarily.
@bglearning bglearning added the 2.x Related to Haystack v2.0 label Jan 29, 2024
@masci
Copy link
Contributor

masci commented Feb 5, 2024

@bglearning can you try to run this code with the main branch? The new run algorithm should behave like you expect.

@bglearning
Copy link
Contributor Author

@masci Seems like it still runs the unnecessary component (here FilterRetriever for the SemanticReader branch).

Setup on Colab

afaict, components with no inputs are immediately added into to_run in the run algorithm.

@github-actions github-actions bot added the stale label May 10, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to Haystack v2.0 community-triage stale
Projects
None yet
Development

No branches or pull requests

2 participants