-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix: PromptNode run raises on empty inputs #7734
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes in haystack/nodes/prompt/prompt_node.py look good to me. I don't see a need for an integration test and suggest we create a unit test instead without using an actual language model. What do you think?
test/prompt/test_prompt_node.py
Outdated
@@ -1212,3 +1212,22 @@ def test_prompt_no_truncation(mock_model, caplog): | |||
with caplog.at_level(logging.DEBUG): | |||
_ = node.prompt(PromptTemplate(prompt)) | |||
assert prompt in caplog.text | |||
|
|||
|
|||
@pytest.mark.integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't really need a real model to test that the invocation_context is set as expected. Let's not use google/flan-t5-base (that's what prompt_model "hf" gets) to check this. Instead let's mock the model and make it a unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. I updated the test :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for updating the PR. 👍
Related Issues
prompt_node.run(query="", documents=documents)
Proposed Changes:
invocation_context
thatis not None
How did you test it?
Notes for the reviewer
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.