Slot not being set by story

I have a categorical slot and I want to set it to true when the ‘affirm’ intent is triggered and false when ‘deny’ intent is triggered but the slot is not getting set at all in both cases. The slot and stories below ( I already tried using boolean slot and it didnt work either plus i need to be able to detect false value, not just true):

  has_outlook_pilot:
    type: categorical
    values:
    - true
    - false

## outlook pilot true
* outlook_pilot
  - utter_ask_has_outlook_pilot
* affirm
  - slot{"has_outlook_pilot": true}
  - action_outlook_pilot

## outlook pilot false
* outlook_pilot
  - utter_ask_has_outlook_pilot
* deny
  - slot{"has_outlook_pilot": false}
  - action_outlook_pilot

Hi Tatiana! Since you didn’t mention if you had tried a boolean slot, I would start there.

I already tried that and it didnt work so i switched to categorical. Plus I need to be able to detect the false value and bool only detects true.

Hi @tatianaf!

I think true and false are strings in this case because they are just the values which your categorical slot can take. Try making them string in your stories, something like this:

## outlook pilot true
* outlook_pilot
  - utter_ask_has_outlook_pilot
* affirm
  - slot{"has_outlook_pilot": "true"}
  - action_outlook_pilot

## outlook pilot false
* outlook_pilot
  - utter_ask_has_outlook_pilot
* deny
  - slot{"has_outlook_pilot": "false"}
  - action_outlook_pilot

Also, I think you are attempting to set the slot in the story. If so, you can’t set a slot in a story. You can only check if a slot is set in a story. There are 3 ways by which you can actually set a slot:

  1. Slots Set from NLU
  2. Slots Set By Clicking Buttons
  3. Slots Set by Actions

See slots doc for more details.

1 Like

Hi, As i understand your use case this is example of slot setting .Have you tried using slot set using clicking buttons?

ok thats the problem Im trying to set slots without having to do entity recognition. Buttons dont allow me to set the slot directly, buttons set the entities for an intent and then the entity automatically sets the slot, correct? The reason I dont want to use an entity is because i have various slots where the value is true/false which would map to utterances like yes/no. So if I have mutliple entities where the training examples are “yes”,“no” then how will the entity classifier know which entity a user is referring to when they type “yes” or “no” instead of using the buttons… that’s why i wanted to use the “affirm” intent to set the slot to “true” in the story… @saurabh-m523

If you convert the story to a form, you can use the slot_mapping function to pass in a value directly from an intent.

Thanks, Ill try that! @b-quachtran

Hi @tatianaf!

Have you tried setting a slot (that does not have a corresponding entity) with buttons?

Idk how much things have changed, but I actually did this in rasa 1.7.2.

So in my case I had a button something like this (trying to adapt for your case):

utter_ask_has_outlook_pilot:
  - buttons:
      - payload: '/affirm{"has_outlook_pilot": "true"}'
        title: 'Yes'
      - payload: '/deny{"has_outlook_pilot": "false"}'
        title: 'No'
    text: "Outlook pilot?"

And in my stories I had written something like this:

## outlook pilot true
* outlook_pilot
  - utter_ask_has_outlook_pilot
* affirm{"has_outlook_pilot": "true"}
  - slot{"has_outlook_pilot": "true"}
  - action_outlook_pilot

## outlook pilot false
* outlook_pilot
  - utter_ask_has_outlook_pilot
* deny{"has_outlook_pilot": "false"}
  - slot{"has_outlook_pilot": "false"}
  - action_outlook_pilot

Now, I had no such entity as has_outlook_pilot anywhere, but I had the categorical slot by that name, just like you have. This obviously gave me some warnings while training and running the model, but it worked absolutely fine.

Idk if this will still work in rasa 1.10.x, but maybe if you are interested, you can try it out. :grin:

This is super helpful thank you! i didnt know you could set slots from buttons without entities but ill try! The only problem is if a user decided to type “yes”/“no” instead of clicking the buttons then it wont work…

Yea it might not work in the case if user types instead of clicking buttons. My use case was such that I had actually restricted free text input when buttons were being displayed.

hey how did u do the restriction of user free text when a button is displayed??