Setting categorical slot value in a form from text

Hi all, I am using a categorical slot in a form. In the form for this slot, I have set the value type to “from_text” and intent “None”. I have an action to fill this slot and in that action, I send buttons that cover all the possible values for this slot. When the user presses a button, I send the corresponding slot value in plain text back to Rasa. I am under the impression that Rasa will use this text and fill the slot, but Rasa seems to ignore the text value and process it as usual and won’t fill the slot. I am not sure what I am missing. Slot definition in domain.yml:

attrib_smoking:
    type: categorical
    auto_fill: true
    values:
      - chain smoking
      - occassional smoking
      - never smoke
    influence_conversation: true

I previously got this working using intents. I define the slot type as “text” instead of categorical. In the buttons payload, I used intents and in the forms, I set the type for this slot as “from_intent” and it worked. The reason I didn’t want to use this approach of using intents is that it is cumbersome to define intents. I have to define as many intents as possible categorical values and in the forms, the slots look ridiculously long as shown below.

attrib_smoking:
      - type: from_intent
        value: chain smoking
        intent: chain_smoking
      - type: from_intent
        value: occassional smoking
        intent: occassional_smoking
      - type: from_intent
        value: never smoke
        intent: never_smoke

Thanks, Kris

Hey Kris!

If you don’t like from_intent (which would be normal in this case), you could use from_entity and define an intent inform with "chain smoking, “occassional smoking”, and “never smoke” as possible values for a smokes entity inside that intent.

You could use this intent for everything similar to that, and, since you use buttons, you don’t have to worry about typos and unexpected answers.

Thanks for the suggestion Chris, I tried using “from_entity”, it now looks better than using intents. Though I am worried the examples for one entity might clash and set different slots. I feel “from_text” is more elegant for my case, though I am not sure what I am doing wrong that it is not working. Do you have any pointers to Rasa examples that show filling categorical slots in forms using “from_text”?

  • Kris

The problem seems to be “intent: None”. If I give an intent value which is triggered by the categorical values of the slot, then type “from_text” works, which mean I have to create this intent with the categorical values of the slot as examples. But the docs says the following:

If intent_name is None , the slot will be filled regardless of intent name. Otherwise, the slot will only be filled if the user’s intent is intent_name .

I thought I can get away without defining the intent by using the value None for intent. Not sure why slot filling does not work if type is “from_text” and intent is “None”.

1 Like

Hello and sorry for the late reply

Did you solve your problem?

Hi Chris, Yes, but the mystery why slot filling does not work if type is “from_text” and intent is “None” remains.

1 Like