Search code examples
rasa-nlurasarasa-core

Problem with stories decided by entities using RASA


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?


Solution

  • 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.