Bot goes to Keraspolicy after FormPolicy

Hi everyone,

I’ve implemented a form in my stories that asks for 2 slots. It fills all slots correctly and continues afterwards. However, unequivocally, the bot uses KerasPolicy from there on out. I want it to keep using memoization. Can someone help? Here’s my stories and my action:

 ## klaar_met_de_test_slot_kenmerken
* klaar
  - utter_form_dan_maar
  - form{"name":"kenmerk_form"}
  - form{"name": null}
> check_branch_pos_neg

## positive
> check_branch_pos_neg
* affirm== ja
    - utter_antwoord_test_2
* inform{"beroep":"pedagogisch medewerker"}
    - utter_cool_beroep
    - action_beroep_image
* affirm || klaar== ja
    - slot{"beroeptof":"ja"}
    - utter_antwoord_test_3_pos
class KenmerkForm(FormAction):

    """ Ask for two qualities of person from test. """

    def name(self) -> Text:
        return "kenmerk_form"

    @staticmethod
    def required_slots(tracker: Tracker) -> List[Text]:
        return ["kenmerk_1", "kenmerk_2"]

    def slot_mappings(self) -> Dict[Text, Text]:
        return {"kenmerk_1": [self.from_entity(entity="kenmerk")],
                "kenmerk_2": [self.from_entity(entity="kenmerk")]}

    @staticmethod
    def valid_kermerken_db():
        # type: () -> List[Text]
        """Database of supported kermerken"""

        return ["realistisch",
                "conventioneel",
                "ondernemend",
                "sociaal",
                "artistiek",
                "intellectueel"]


    def validate_kenmerk(self,
                         value: Text,
                         dispatcher: CollectingDispatcher,
                         tracker: Tracker,
                         domain: Dict[Text, Any]) -> Optional[Text]:
        """Validate kenmerk value."""

        if value.lower() in self.valid_kermerken_db():
            # validation succeeded
            return value
        else:
            dispatcher.utter_template('utter_wrong_kenmerk', tracker)
            # validation failed, set this slot to None, meaning the
            # user will be asked for the slot again
            return None



    def submit(self,
               dispatcher: CollectingDispatcher,
               tracker: Tracker,
               domain: Dict[Text, Any]
               ) -> List['Event']:

            dispatcher.utter_template('utter_antwoord_kenmerk_2', tracker)
            return []

Then after it utters the submit message, it uses keras to predict ‘action_listen’ as the next action.

@Remy two things that strike me here –

  1. Are both of the slots filled during your form unfeaturized?
  2. Have you tried this without checkpoints and verified the same issue?
2 Likes

Heya Ella,

Thanks for the reaction. I’ve tried a lot of things in the meantime and I’ve fixed the issue by making the slots unfeaturized. EDIT: I didn’t realize they had to be unfeaturized at first.

To answer the 2nd question first: Checkpoints weren’t the issue. They just stitch together 2 stories. As long as those connect in the same way the form will work fine.

The issue with my case was as follows:

The entities that were filled out in the form were also used as a categorical slot, so the user can ask questions about them as well. e.g: they could ask “what does realistisch mean?”. If I make the slot unfeaturized, my users wouldn’t be able to ask that question.

So now I’ve implemented buttons in the form that SEEM like they fill out that entity. However, They actually map to an unfeaturized slot that I use nowhere else. It’s a bit of a ragtag solution, but it works.