-
Notifications
You must be signed in to change notification settings - Fork 232
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 template response by ActionQueryKnowledgeBase to correctly use string representation of kb item. #407
Conversation
…e string representation of the knowledge base item retrieved by the action. Add corresponding test.
FYI: Looks like this has actually been proposed to be fixed before: #365 |
Thanks for submitting a pull request 🚀 @rgstephens will take a look at it as soon as possible ✨ |
@kedz Sorry, I'm on vacation from tomorrow till next Friday. Could you please request review by somebody else? 🙌🏻 |
Hey @kedz ! |
Thanks @alwx ! I made the code style fix and added a changelog entry. I think this is good to merge? |
Yes, perfect, thank you! |
When using ActionQueryKnowldgeBase, the action utters a templated response to queries about the knowledge base items of the form: "'{NAME}' has the value '{VALUE}' for attribute '{ATTRIBUTE}'." NAME is supposed to be the string representation of the knowledge base item, however, it is currently returning the string representation of the function used to generate the string representation of the kb item. E.g.:
instead of
This pull request fixes this bug so that templated responses produced by the action uses the string representation of the kb item.
In addition to fixing the bug in
rasa_sdk/knowledge_base/actions.py
, this pull request also modifiestests/knowledge_base/test_actions.py
to check that templated responses are generated correctly.Note: When I ran
make lint
,black
suggested that the call signature forrun
(line 103 inrasa_sdk/knowledge_base/actions.py
) be on one line so I made that change as well.To Reproduce the Bug
Status (please check what you already did):
black
(please check Readme for instructions)