FormAction must not proceed untill are slots are not filled

FormAction slot was requested but nothing was extracted it will allow other policies to predict another action.

But I want this, It should not allow to predict untill slots does not get filled.

you need to override validate and do not raise Exception

Hi @Ghostvv I need your help please I want to use forms for a specific case I have and I can’t get it to work.

In actions as a form I have :

class IdeasmineForm(FormAction):
"""Accept free text input from the user for suggestions"""

def name(self):
    return "ideasmine_form"

@staticmethod
def required_slots(tracker):
    return ["ideasmine_message"]

def slot_mappings(self):
    return {"ideasmine_message": self.from_text()}

def submit(self, dispatcher, tracker, domain):
    return[]

So I want to take the input of the user as it is, I know the user will give me the intent : ideasmine_message but I don’t know what it will be it’s very random so in my intents I can’t give examples for this intent. This is why I want to use forms to just get the user input and take this as ideasmine_message intent/slot

After the FormAction I want to tell the user simply that he taped {ideasmine_message[text]}, so in my stories I have the next action like:

class action_SendIntent_B_S(Action):
     def name(self):
        return 'action_SendIntent_B_S'
    def run(self, dispatcher, tracker, domain):		
        loc = tracker.get_slot('ideasmine_message')
        response = """Hi user you said {} , """.format(loc['text'])				
        dispatcher.utter_message(response)

Just tell the user what he taped.

stories.md

happy path

  • bonjour

    • utter_bonjour
  • confirmer

    • ideasmine_form
    • form{“name”: “ideasmine_form”}
    • form{“name”: null}
    • action_SendIntent_B_S

in domain.yml

- utter_ask_ideasmine_message
- action_etape4

forms: 
 - ideasmine_form
intents:
- confirmer
- ideasmine_message

entities:
 - ideasmine_message

slots:

ideasmine_message:
type: unfeaturized
auto_fill: false
templates:
utter_ask_ideasmine_message:
   - text: What is your Idea?
utter_bonjour: 
 - text: hi, do you need help?

What I realy want is:

 user: Hi (*bonjour)
 bot: hi, do you need help? (-utter_bonjour)
 user: yes (*confirmer) 
 bot: what is your idea? (I could of use this in stories as *ideas_message but the problem is that I don't know what should I receive as an answer it could be any thing, this why I want to use forms. So the bot will execute ideasmine_form which will show the utter_ask_ideasmine_message)
 user: my idea is my idea (filling the form and taking this sentence as ideasmine_message slot)
 bot: you said: my idea is my idea (action_SendIntent_B_S)

when I tried this with interactive learning the bot predict well till the ideamine_form (correct?) I tape Yes, then the bot show the utter_ask_ideamine_message and propose to listen I tape Yes and taped the idea (my idea is my idea) Here it stops because the bot propose to classify this as None intent and if I tell him to classify it as ideamine_message he re do the ideamine_form as the new action.

Am I doing something wrong ? I’am using the last versions of both rasa_nlu and rasa_core

I didn’t understand, what is the problem?

How would I do that ? Do I have to changed the conditions ?? I did not get you.

The embadding policy just jumps over the Form and keras policy is a liltle good but also jumps when it could not fill the Form.

remove this: rasa_core_sdk/forms.py at 7f91132aecda9c4ea6f1c97a58a52ed5a7178efe · RasaHQ/rasa_core_sdk · GitHub

1 Like

These line of code ??

            if not slot_values:
                # reject to execute the form action
                # if some slot was requested but nothing was extracted
                # it will allow other policies to predict another action
                raise ActionExecutionRejection(self.name(),
                                               "Failed to validate slot {0} "
                                               "with action {1}"
                                               "".format(slot_to_fill,
                                                         self.name()))

yes