Problem with stories decided by entities using RASA

1.9k Views Asked by At

I'm using Rasa and I have problems 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?

2

There are 2 best solutions below

0
On BEST ANSWER

To get the behaviour you want here, you will need to use slots. The entities are only featurised in a [1,0] way - whether the entity is present or not. If you define a categorical slot, with all the different expected values, then your bot should predict the actions correctly.

Alternatively, if you want to use a custom action for this conversation flow anyways, you might consider just having one story, like:

 - story: descripcion
  steps:
 - intent: descripcion
    entities: 
    - concepto
 - action: action_descripcion

And within that action you check the entity value and return the correct response based on that.

0
On

Besides setting up slot type to be categorical, you also have to set influence_conversation=true in domain.yml. This page (https://rasa.com/docs/rasa/domain/) shows you which slot types influence based on whether it is set or not, and which slot types influence based on its value (more granular than the former).