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

Custom action class for validating slots with one custom action #6819

Closed
2 tasks
wochinge opened this issue Sep 28, 2020 · 1 comment · Fixed by RasaHQ/rasa-sdk#288
Closed
2 tasks

Custom action class for validating slots with one custom action #6819

wochinge opened this issue Sep 28, 2020 · 1 comment · Fixed by RasaHQ/rasa-sdk#288
Assignees
Labels
area:rasa-sdk 🧑‍💻 Everything that touches our python Rasa SDK type:enhancement ✨ Additions of new features or changes to existing ones, should be doable in a single PR

Comments

@wochinge
Copy link
Contributor

This is actually an SDK issue but I added it here so we can add it to the milestone.

Description of Problem:
Docs specify that all slot validations for a given form is happening as a single function, which is confusing because validation is always unique for each slot. Users will still have to define separate validation functions, but they'll also have to write the logic inside run() for calling each validate method.

Also see the long discussions here

Overview of the Solution:
Some magic class ala

class AbstractFormValidatorAction(Action):

  def run(...):
    slots_to_validate = tracker.form_slots_to_validate()
    for slot_name, value in slots_to_validate.items():
       function_name = f"validate_{slot_name}"
       fn = getattr(self, function_name)
       fn(value, tracker, bla)

Definition of Done:

  • Implementation
  • Updated Rasa Open Source docs
@wochinge wochinge added type:enhancement ✨ Additions of new features or changes to existing ones, should be doable in a single PR area:rasa-sdk 🧑‍💻 Everything that touches our python Rasa SDK labels Sep 28, 2020
@wochinge
Copy link
Contributor Author

Please find a better name for AbstractFormValidatorAction. That's just a placeholder 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-sdk 🧑‍💻 Everything that touches our python Rasa SDK type:enhancement ✨ Additions of new features or changes to existing ones, should be doable in a single PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants