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

FormSlotsValidatorAction added #288

Merged
merged 16 commits into from
Oct 5, 2020
Merged

FormSlotsValidatorAction added #288

merged 16 commits into from
Oct 5, 2020

Conversation

alwx
Copy link
Contributor

@alwx alwx commented Oct 1, 2020

Proposed changes:

Status (please check what you already did):

  • made PR ready for code review
  • added some tests for the functionality
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@alwx alwx marked this pull request as ready for review October 2, 2020 08:30
@alwx alwx requested a review from wochinge October 2, 2020 08:36
@alwx
Copy link
Contributor Author

alwx commented Oct 2, 2020

Will update https://rasa.com/docs/rasa/forms#validating-form-input once we merge this one :)

@wochinge
Copy link
Contributor

wochinge commented Oct 2, 2020

I'll try to squeeze in the review between retro and tech onboarding .Do you already have a matching docs PR on Rasa Open Source side?

Copy link
Contributor

@wochinge wochinge left a comment

Choose a reason for hiding this comment

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

Nice testing 🥇 Left a couple of comments 🙈

@@ -0,0 +1,2 @@
Add the `FormSlotsValidatorAction` abstract class that can be used
to validate slots which were extracted by a Form.
Copy link
Contributor

Choose a reason for hiding this comment

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

let's also add a usage example :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant actually here in the changelog. I think users are more likely to look into the changelog then the codebase.

rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/interfaces.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
@alwx alwx requested a review from wochinge October 2, 2020 14:34
Copy link
Contributor

@wochinge wochinge left a comment

Choose a reason for hiding this comment

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

looks great

@@ -0,0 +1,2 @@
Add the `FormSlotsValidatorAction` abstract class that can be used
to validate slots which were extracted by a Form.
Copy link
Contributor

Choose a reason for hiding this comment

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

I meant actually here in the changelog. I think users are more likely to look into the changelog then the codebase.

rasa_sdk/forms.py Outdated Show resolved Hide resolved
tests/test_forms.py Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
@alwx alwx mentioned this pull request Oct 2, 2020
2 tasks
@alwx
Copy link
Contributor Author

alwx commented Oct 5, 2020

I made it work the way it worked before (in the current implementation events get updated in slots dictionary) but I still have no idea if it's the right behavior or not because there is nothing about it in the description.
@wochinge could you please check and verify if the logic is correct?

@alwx alwx requested a review from wochinge October 5, 2020 08:28
Copy link
Contributor

@wochinge wochinge left a comment

Choose a reason for hiding this comment

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

I made it work the way it worked before (in the current implementation events get updated in slots dictionary) but I still have no idea if it's the right behavior or not because there is nothing about it in the description.

Looks great 🥇 Just a few comments, then we're ready to go. Where would you expect a description?

rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
tests/test_forms.py Show resolved Hide resolved
tests/test_forms.py Outdated Show resolved Hide resolved
changelog/288.improvement.md Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
tests/test_forms.py Outdated Show resolved Hide resolved
tests/test_forms.py Outdated Show resolved Hide resolved
@wochinge
Copy link
Contributor

wochinge commented Oct 5, 2020

@alwx I thought about whether the validation_function should return a List[EventType] (e.g. SlotSet for the validated slots) instead of the dictionary which we are currently returning. I think it makes sense to do it as you did and keep the old implementation which returns the plain Dict as users were happy with that and then there is one less thing for them to re-learn / change.

@alwx
Copy link
Contributor Author

alwx commented Oct 5, 2020

@wochinge done

@alwx alwx requested a review from wochinge October 5, 2020 11:09
Copy link
Contributor

@wochinge wochinge left a comment

Choose a reason for hiding this comment

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

💯

rasa_sdk/forms.py Show resolved Hide resolved
tests/test_forms.py Outdated Show resolved Hide resolved
rasa_sdk/forms.py Outdated Show resolved Hide resolved
@alwx alwx force-pushed the form-slots-validator-action branch from ea20b3a to 02e30bd Compare October 5, 2020 12:05
@alwx alwx merged commit 57aca39 into master Oct 5, 2020
@alwx alwx deleted the form-slots-validator-action branch October 5, 2020 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom action class for validating slots with one custom action
2 participants