Rasa: FormAction Submit fails to use dispatcher

Created on 27 Nov 2019  路  6Comments  路  Source: RasaHQ/rasa

Rasa version: 1.5.0
Python version: 3.6.8

Operating system: Windows 10

Issue:

After succesfully asking for every slot to be filled, the bot submits the form. Inside the submit method, I am using a custom utterance:

        response = dict(
            x=tracker.get_slot('x'),
            y=tracker.get_slot('y'),
            z=tracker.get_slot('z'),
            a=tracker.get_slot('a'),
            b=tracker.get_slot('b'),
            text='utter_submit_success'
        )
        dispatcher.utter_message(json_message=response)
        return []

Since you marked the other utterance-methods as deprecated, I am now testing this one. The following code lies in executor.py of rasa_sdk:

        message = {
            "text": text,
            "buttons": buttons,
            "elements": elements,
            "custom": json_message,
            "template": template,
            "image": image,
            "attachment": attachment,
        }
        message.update(kwargs)
        print(message)

        self.messages.append(message)

and results in:

2019-11-27 17:31:00 DEBUG    rasa_sdk.forms  - No slots left to request, all required slots are filled:
        x: True
        y: 4
        z: ['4', '4']
        a: 4sdf
2019-11-27 17:31:00 DEBUG    rasa_sdk.forms  - Submitting the form 'incident_form'
{'text': None, 'buttons': None, 'elements': (), 'custom': {'x': True, 'y': '4', 'z': ['4', '4'], 'a': '4sdf', 'b': None, 'text': 'utter_submit_success'}, 'template': None, 'image': None, 'attachment': None}
2019-11-27 17:31:00 DEBUG    rasa_sdk.forms  - Deactivating the form 'incident_form'
2019-11-27 17:31:00 DEBUG    rasa_sdk.executor  - Finished running 'incident_form'

So there is no error, but _utter_responses which iterates over the dispatchers utterances is never triggered aswell whereas while filling the slots, it actually is triggered.

So it seems that messages sent out of the submit method aren't parsed. Am I doing something wrong?

type

Most helpful comment

Perfect. It works! :-)

All 6 comments

Hey @JulianGerhard21, I think this is probably related to the error you reported earlier. Could you try the master versions of rasa and rasa-sdk and tell me what the output is like? (rasa-sdk 1.5.1 is already built, rasa 1.5.1 is on its way)

but _utter_responses which iterates over the dispatchers utterances is never triggered aswell whereas while filling the slots, it actually is triggered. So it seems that messages sent out of the submit method aren't parsed.

Not sure I quite understand what you mean here.

Hi @erohmensing ,

of course - I will do it directly and give you feedback.

Not sure I quite understand what you mean here.

I did not do a lot of experiments with the core actions but I observed, that every message that a bot wants to utter sooner or later gets to:

    async def _utter_responses(
        responses: List[Dict[Text, Any]],
        output_channel: "OutputChannel",
        nlg: "NaturalLanguageGenerator",
        tracker: "DialogueStateTracker",
    ) -> List[BotUttered]:
        """Use the responses generated by the action endpoint and utter them."""

After experiencing that the FormAction works properly but does not utter anything in the last step while submitting properly, I started to debug a bit and found out, that indeed the message does not get to _utter_responses. The other FormAction-Utterances (like ask_slot_name) however are getting there.

That's why I wondered that there might be a problem with the dispatcher at this point.

Hm, okay, you're trying to create a custom utterance, so this part

{'text': None, 'buttons': None, 'elements': (), 'custom': {'x': True, 'y': '4', 'z': ['4', '4'], 'a': '4sdf', 'b': None, 'text': 'utter_submit_success'}, 'template': None, 'image': None, 'attachment': None}

looks correct, right?

p.s. both 1.5.1 versions should be on pypi now :)

Exactly - the print statement was added to make sure that the utterance itsself is generated correctly. It seems to me that it does not get processed.

Perfect. It works! :-)

Was this page helpful?
0 / 5 - 0 ratings