Skip to content
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

Raising exception when having empty intent or entity mapping in the domain #8222

Merged
merged 8 commits into from
Mar 25, 2021

Conversation

Imod7
Copy link
Contributor

@Imod7 Imod7 commented Mar 17, 2021

Proposed changes:

  • Added an InvalidDomain exception when having an empty intent/entity mapping in the domain.yml file.

Status (please check what you already did):

  • added two tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@Imod7 Imod7 added the area:rasa-oss 🎡 Anything related to the open source Rasa framework label Mar 17, 2021
@Imod7 Imod7 linked an issue Mar 17, 2021 that may be closed by this pull request
@Imod7 Imod7 force-pushed the empty_intent_mapping_in_domain branch from 0f2dff7 to f90ac7f Compare March 17, 2021 17:47
- Replaced try/except statement with if/else when checking if intent mapping is empty.
- Minor rewording on the exception message.
- Added a new test to check if the exception is correctly raised.
@Imod7 Imod7 force-pushed the empty_intent_mapping_in_domain branch from f90ac7f to be336d9 Compare March 17, 2021 17:50
@Imod7 Imod7 marked this pull request as ready for review March 17, 2021 21:30
@Imod7 Imod7 requested review from a team, kalkbrennerei and alwx and removed request for a team and kalkbrennerei March 17, 2021 21:30
Copy link
Contributor

@alwx alwx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved but please take a look at the two small comments I've left :)

rasa/shared/core/domain.py Outdated Show resolved Hide resolved
rasa/shared/core/domain.py Show resolved Hide resolved
- Rewording of the function's docstring.
- Rewording of the InvalidDomain exception message.
@Imod7
Copy link
Contributor Author

Imod7 commented Mar 19, 2021

Hi @alwx ! Thank you so much for your review and constructive feedback! Please let me know if any further rewording is needed in the docstring or the exception.

After making the current changes for the empty intent mapping, I also thought that a user might also insert an empty entity mapping so in the domain.yml file maybe we get something like this :

entities:
  - cuisine:

instead of the correct one :

entities:
  - cuisine

and the error we get when having the empty entity mapping is the following :

TypeError: argument of type 'NoneType' is not iterable

I checked the code and saw that if I add a check here, then instead of the error I can raise another InvalidDomain exception message.
Should I add this check? If yes, should I do it in the current PR or open a new Issue ?
Thank you so much for your time!!! 🙏🏽

@Imod7 Imod7 requested a review from alwx March 19, 2021 15:25
@alwx
Copy link
Contributor

alwx commented Mar 22, 2021

Since it's a small change and because it's related to what you've done here, then I think it's perfectly fine to do it in the same PR. Don't forget to update the changelog entry in this case! :)

- Added a check to handle also empty entity mapping.
- Changed the changelog.
- Added a test for the empty entity mapping.
@Imod7 Imod7 changed the title Added an InvalidDomain exception when having an empty intent mapping Raising exception when having empty intent or entity mapping in the domain Mar 22, 2021
@Imod7 Imod7 requested review from alwx and joejuzl March 23, 2021 07:39
@wochinge
Copy link
Contributor

@joejuzl Do you have time for another quick review so this PR can get wrapped up?

Copy link
Contributor

@joejuzl joejuzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Imod7 Imod7 enabled auto-merge March 25, 2021 14:55
@Imod7 Imod7 merged commit 8e5ec4d into main Mar 25, 2021
@Imod7 Imod7 deleted the empty_intent_mapping_in_domain branch March 25, 2021 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle empty intent mapping in domain
4 participants