-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
warn for invalid keys for components #7134
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.
Thanks for taking this over 🙌
changelog/6966.improvement.md
Outdated
@@ -0,0 +1 @@ | |||
Added warning for when an option is provided for a component that is not listed as a key in the defaults for that component. |
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.
can we add the link to the documentation for Component
s please?
rasa/nlu/components.py
Outdated
|
||
for component in pipeline: | ||
component_name = component.get("name") | ||
component_class = registry.get_component_class(component_name) |
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.
Note that this may raise an exception. Maybe it would be better to run the validation within _build_pipeline
?
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.
Or even better within component.create_component
?
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.
that would also avoid having to do the check in two locations?
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.
mm I tried moving it into component.create_component
, but in that case extra keys are present that aren't allowed for the child class, but are for the base class (e.g. intent_classification
is present for ResponseSelector
). So, it isn't only checking the user-provided config at that point.
Re. putting it in _build_pipeline
- you mean moving the logic inside the function instead of calling it from there? Which exception would that avoid?
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.
it would have the advantage that you don't have to load the components yourself in _build_pipeline
(which can go wrong and then you'd need error handling).You'd already have the instantiated components in _build_pipeline
which should simplify your validations.
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.
I moved it - does that work?
Co-authored-by: Tobias Wochinger <t.wochinger@rasa.com>
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.
Couple of smaller suggestions. Please have look. Looks good otherwise 🚀
Co-authored-by: Tobias Wochinger <t.wochinger@rasa.com>
Co-authored-by: Tobias Wochinger <t.wochinger@rasa.com>
Proposed changes:
Status (please check what you already did):
black
(please check Readme for instructions)Should this raise
InvalidConfigError
instead, the wayvalidate_requirements
does?