Slot form_intent affirm/deny get filled with the first recognized intent affirm/deny at the wrong places

Hi all,

I’m experimenting a bit with conditional responses. For that, I have different slots in which the user gets ask e.g. did you like it? or did you try it? … These slots should be filled with from_intent with values no or yes (or true or false) respectively. However, if there is another affirm or deny intent somewhere else in the conversation the slots get just filled, even though they should be filled only when asked these questions.

Here is my implementation:

responses:
  utter_continute: 
  - text: "Do you want to continue?"

  utter_food_trying: 
  - text: " Ever tried it?"

  utter_food_ask_if_tried_liked_it:
    - condition:
        - type: slot
          name: tried_food
          value: yes
      text: "And did you like it?"
    - condition: 
        - type: slot
          name: tried_food
          value: no
      text: "Oh okay! I can just say it is great."

  utter_food_liked_true_or_false:
    - condition:
        - type: slot
          name: tried_food
          value: yes
        - type: slot
          name: tried_food
          value: no
      text: "Me too!"
    - condition: 
        - type: slot
          name: tried_food
          value: yes
        - type: slot
          name: liked_food
          value: no
      text: "Maybe you should give it another try."
    - condition: 
        - type: slot
          name: liked_food
          value: no
      text: "Okidoki."



slots:
  tried_food:
    type: bool
    influence_conversation: true
    mappings:
    - type: from_intent
      intent: affirm
      value: yes
    - type: from_intent
      intent: deny
      value: no
  liked_food:
    type: bool
    influence_conversation: true
    mappings:
    - type: from_intent
      intent: affirm
      value: yes
    - type: from_intent
      intent: deny
      value: no

And my story:


stories:
- story: happy path food
  steps:
  - action: utter_continute
  - intent: affirm
  - action: utter_food_trying
  - or:
    - intent: deny
    - intent: affirm
  - action: utter_food_ask_if_tried_liked_it
  - or:
    - intent: deny
    - intent: affirm
  - action: utter_food_liked_true_or_false

I could create different intents for telling whether the tried it or liked it but this would be very similar nlu training data as the affirm and deny intent. So how can I make sure that those slots are only filled in this context and not somewhere else in the interaction e.g. whether the user wants to know the time or anything else which would be answered with yes or no…

Many thanks!

1 Like

have you tried using a custom action to clear the slots tried_food and liked_food in the story like this:


stories:
- story: happy path food
  steps:
  - action: utter_continute
  - intent: affirm
  - action: utter_food_trying
  - or:
    - intent: deny
    - intent: affirm
  - action: utter_food_ask_if_tried_liked_it
  - action: action_clear_slots
  - or:
    - intent: deny
    - intent: affirm
  - action: utter_food_liked_true_or_false

this way you could clear the slots, and wait the next intent to set them again, not the best way but you could try.

2 Likes

Hi @Reckl3s

Thanks for your input, nice idea! I may check it out. I like the global slot filling so I would say my learning for today was that something like affirm and deny as intents to fill a slot should probably only be used within a form. Your advice was highly appreciated though! :slight_smile:

2 Likes

I just struggled with a similar issue and solved it using mapping conditions. Hopefully that works for you too

1 Like

Hi @wlu07 Thank you for your suggestion!

I forgot to write this in my example code above but I actually have the mapping condition implemented and still it does not prevent that it is filled by the intent coming before the form, unfortunately.

1 Like

Did you end up solving it another way? If you’re still stuck on it, my question and solution using mapping conditions is posted here: Multiple yes/no questions in a form

1 Like