Problem with stories decided by entities

Hi, I have a problem with some stories. To sum up, I have this:

- story: descripcionClaveFirma
  steps:
  - intent: descripcion
    entities: 
    - concepto: "clave firma"
  - action: descripcionClaveFirma

- story: descripcionSede
  steps:
  - intent: descripcion
    entities: 
    - concepto: "sede electronica"
  - action: descripcionSede

and I want to select the action based on the entity “concepto” sinche the intent “description” is the same in both cases. After train, Rasa core don’t select the appropiate actions even though the tracker have the entity.

I get this user intent: descripcion | user entities: (‘concepto’,) | previous action name: action_listen Do I have the entity value in the second argument? lik (‘concepto’,‘sede electronica’) for example

How can I write it to get the Action I need?

1 Like

There’s a subtle difference between deciding the next action based on entities vs. slots. Slots can direct a story based on both the name of the slot and its value, depending on the featurization. Entities can only direct a story based on the name, value is not taken into consideration.

What you can do, is create a categorical slot of the same name:

slots:
  concepto:
     type: categorical
     values:
       - clave firma
       - sede electronica

This slot will be autofilled when the entity concepto is extracted, and you can then direct your stories based on the slot value:

- story: descripcionClaveFirma
  steps:
  - intent: descripcion
    entities: 
    - concepto
  - slot_was_set:
    - concepto: "clave firma"
  - action: descripcionClaveFirma

- story: descripcionSede
  steps:
  - intent: descripcion
    entities: 
    - concepto
  - slot_was_set:
    - concepto: "sede electronica"
  - action: descripcionSede

hope this helps

1 Like

Thanks. I understand it now. I have seen that you can use the value of the entity in stories here: Stories and I thought that it was enough. Besides, I have seen this: Domain where the example says: “This means the following two stories are equal:” What’s the difference?

The example referred to:

stories:
- story: French cuisine
  steps:
  - intent: inform
  - slot_was_set:
    - cuisine: french

- story: Vietnamese cuisine
  steps:
  - intent: inform
  - slot_was_set:
    - cuisine: vietnamese

Are referring to a slot of type text. That means, it is featurized one way if there is any value, and another way if it is empty. Categorical slot types are different.

You can indeed, format wise; and for your own reference it can be helpful. But, the dialogue engine will not pay any attention to it.

I’m taking the topic to ask a second related question: It’s possible to activate an action depending on two values of a categorical variable? I mean, in first example, if I have concepto as categorical variable with [“clave firma”, “sede electronica”, “chatbot”, “email”] values, how do I trigger the same action when “chatbot” OR “email” is in the sentence? Do I have to do two stories?

Could you rather post your last q as a new topic? It makes it easier for other interested community members to find.

Hi @mloubser,

I am new to Rasa, can you please explain what purpose the entity values serve.

What i mean is, why an option to specify “sede electronica” as below, is given if it can’t steer a story

steps:

  • intent: descripcion entities:
    • concepto: “sede electronica”
1 Like

I agree, this is unnecessarily misleading. The docs should be updated as well to emphasise that values are not used.

One thing to note (and I agree that this is confusing, and I recommend being explicit in your stories regardless), there is one case where specifying the entity value is necessary, and therefore supported - if you are autofilling e.g. a categorical slot with your entity, and you specify a value for the entity that matches directly one of the categories in your categorical slot, you can leave out the slot_was_set step; it is assumed.

Please see the Note in the documentation (linked above) for auto-filliing + influence_conversation: true.

1 Like