haystack
haystack copied to clipboard
feat: add required flag for prompt builder inputs
Related Issues
- changes PromptBuilder behavior according to #7441
Proposed Changes:
PromptBuilder now takes a new optional parameter required_variables upon initialization to specify a list of jinja template variables that must be provided at all times. During pipeline or component runs, a properValueError will be thrown if some of the required variables are missing.
How did you test it?
Added a new unit test. Tested by following the 2.0 RAG pipeline recipe from https://docs.haystack.deepset.ai/docs/creating-pipelines
Notes for the reviewer
For the sake of completeness, I also added a validation check in PromptBuilder.run().
Checklist
- I have read the contributors guidelines and the code of conduct
- I have updated the related issue with new insights and changes
- I added unit tests and updated the docstrings
- I've used one of the conventional commit types for my PR title:
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:. - I documented my code
- I ran pre-commit hooks and fixed any issue
Previous PR: #7442 . I devided to make a new one since this should not be considered a fix anymore.
Pull Request Test Coverage Report for Build 8715948805
Details
- 0 of 0 changed or added relevant lines in 0 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage increased (+0.01%) to 90.073%
| Totals | |
|---|---|
| Change from base Build 8664841004: | 0.01% |
| Covered Lines: | 6261 |
| Relevant Lines: | 6951 |