feat!: Dont run nodes with only default inputs #8680
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issues
Proposed Changes:
Currently, nodes with only default inputs (or a variadic input without any input) are run by the pipeline. This PR changes that.
An example to motivate the change is the prompt builder: Assume that we have a pipeline for structured output, similar to this example. But instead of the prompt builder being run every time, we want it to only run sometimes. In this case, if the pipeline does not run the prompt builder and reaches its end, the prompt builder suddenly runs without being passed any input and the whole skipped branch runs. See the cropped pipeline below:
This is obviously a breaking change. I think it is worth it anyway as the issue is quite hard to work around in more complicated pipelines and occurs multiple times in my project and presumably others too.
How did you test it?
The unit tests were adapted to reflect the changes. I also successfully use the PR in my project.
Notes for the reviewer
Review after #8679 as it is based on that one.
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
and added!
in case the PR includes breaking changes.