How to prompt user for missing entities in a group?

Let’s say I label all my utterances with entities and groups. For example (taken from the rasa docs):

Give me a [small]{"entity": "size", "group": "1"} pizza with [mushrooms]{"entity": "topping", "group": "1"} and
a [large]{"entity": "size", "group": "2"} [pepperoni]{"entity": "topping", "group": "2"}

So let’s say the bot recognizes both the size and topping entities for group 1 but only the size entity for group 2.

Is there a way to prompt the user for a topping for group 2?

I’m thinking of using a custom action to find groups with missing entities but am not sure how to ask the user for input and how this changes the stories.

Hello @hsm207, welcome back to the forum :slight_smile:

Since Rasa 2.1.0, roles and groups can also influence the conversation. Before that, they didn’t. So if you are on a recent version you can write stories such as

- story: User provides everything
  steps:
    - intent: inform
      entities:
        - size: small
          group: 1
        - topping: mushrooms
          group: 1
        - size: large
          group: 2
        - topping: pepperoni
          group: 2
      - utter_something
- story: User doesn't provide size for second pizza
  steps:
    - intent: inform
      entities:
        - size: small
          group: 1
        - topping: mushrooms
          group: 1
        - topping: pepperoni
          group: 2
      - action_ask_size

This, however, might require a lot of training data for Rasa core to get all the possible combinations right. So using a custom action, as you’ve suggested, might be better. In fact, you can use a validation action for a form. To influence the conversation, you could use a custom slot type that has a feature which indicates whether all groups are complete.

1 Like