Buttons, payloads and slots oh my

The quick of it is that I’m trying to do validation on a slot and the value I’m expecting isn’t what is stored in the slot.

Using rasa shell as my development UI, I display the values of my slots in a summary and you can see that the entire json object was stored in the slot after clicking a button.

Subject: /inform{"subject_level_one": "Accounts"}

My python validation is expecting “Accounts” as the value so it doesn’t trigger.

I can get this to validate if I change my if statement to expect /inform{"subject_level_one": "Accounts"} but that can’t be the proper way to do this, right?

My button code in my domain.yml file looks like this:

  utter_ask_subject_level_one:
    - text: "Could you choose from the list what this about: [Subject Level 1]"
      buttons:
        - title: "Accounts"
          payload: '/inform{"subject_level_one": "Accounts"}'
        - title: "General"
          payload: '/inform{"subject_level_one": "General"}'
        - title: "System Functionality"
          payload: '/inform{"subject_level_one": "System Functionality"}'
        - title: "Training"
          payload: '/inform{"subject_level_one": "Training"}'

To make this even more fun, in my validation code I added:

      print (tracker.get_slot("subject_level_one"))
      print (value)

And I see this in the action server console.

Accounts
/inform{"subject_level_one": "Accounts"}

Anyone have thoughts on why these are completely different? The slot is correctly set, however in the utter_display summary which I thought would contain the slot’s value in curly braces has the entire object.

That code looks like this (I trimmed it down, but you get the idea):

  utter_display_summary:
    - text: "Thank you. I will include the following information when I forward this to support. An email will be sent to {customer_email} shortly as well. \n
          ----------------------------------------\n
          Subject: {subject_level_one}\n

Hello @jonathanpwheat,

Just a wild guess, it seems to me like the form understands that the whole input is value for slot “subject_level_one”. This behavior is kinda similar to mapping the slot with self.from_text(). Can you try specifically map the slot with the entity “subject_level_one” ? Detail about custom slot mapping in form: Forms

1 Like

Oh man, now I feel silly. This was boggling my mind.

I had self.from_text(intent=None), which now makes total sense, it was taking the literal text string from the button option’s payload and setting the slot. #facepalm

After reading the doc page you linked to, changed it to self.from_entity(entity="product_name"),

and it worked. Thank you!