Choosing Stories based on Existing Slot values

Hey, I have a bit of conundrum. I want to make a use case where depending on the value of a slot, or whether it is filled or not. I want to create different stories.

Here is a simple example:

----- nlu.md---------------

intent:affirm

  • yes
  • indeed
  • of course
  • that sounds good
  • correct

intent:b_tellme

  • tell me about the color
  • tell about color
  • tell color

intent:choose

intent:debug

  • debug
  • test
  • testing

intent:deny

  • no
  • never
  • I don’t think so
  • don’t like that
  • no way
  • not really

intent:goodbye

  • bye
  • goodbye
  • see you around
  • see you later

intent:greet

  • hey
  • hello
  • hi
  • good morning
  • good evening
  • hey there
  • hi

intent:r_tellme

  • tell me about the color
  • tell about color
  • tell color

synonym:blue

  • {“color”: “blue”}

synonym:red

  • {“color”: “red”}

--------------stories.md----------------------------------

greet path

  • greet
    • utter_greet
  • choose
    • utter_response

say goodbye

  • goodbye
    • utter_goodbye

tell color path

  • r_tellme{“color”:“red”}
    • utter_red

tell color path2

  • b_tellme{“color”:“blue”}
    • utter_blue

tell color path3

  • r_tellme
    • utter_nono1

tell color path4

  • b_tellme
    • utter_nono2

debug path

  • debug
    • utter_response

----------------domain.yml--------------------------------

%YAML 1.1

actions:

  • utter_blue
  • utter_did_that_help
  • utter_goodbye
  • utter_greet
  • utter_nono1
  • utter_nono2
  • utter_red
  • utter_response

entities:

  • color

intents:

  • greet
  • choose
  • goodbye
  • affirm
  • deny
  • r_tellme
  • b_tellme
  • debug

slots: color: type: unfeaturized

templates: utter_blue:

  • text: Color is blue

utter_did_that_help:

  • text: Did that help you?

utter_goodbye:

  • text: Bye

utter_greet:

  • buttons:

    • payload: ‘/choose{“color”: “blue”}’ title: blue
    • payload: ‘/choose{“color”: “red”}’ title: red

    text: Hey! How are you?

utter_nono1:

  • text: Nono 1

utter_nono2:

  • text: Nono 2

utter_red:

  • text: Color is red

utter_response:

  • text: ‘{color}’

Based on the stories, you can see that I want the (tell color 1) to trigger if my color slot is set to “red”, (tell color2) story to trigger if the color slot is set to “blue” and the other 2 stories to trigger if my color is not set beforehand. Is there any alternate way to implement this if the functionality is not available?

First of all, an unfeaturized slot doesn’t affect the flow of the conversation. You can try using a categorical slot. If that doesn’t work, use a text slot and create a custom action to select the response according to the color.

1 Like

Thanks for the quick reply.

Is there any good categorical slot project example, that I can use to understand its usage and implement it into my code?

I don’t know if one exists. This one tells you the basics of stories: https://docs.botfront.io/rasa/stories/#introduction-to-rasa-stories

1 Like

Hey,

Unfortunately this part did not work. I will still keep this query open in case someone has a solution.

Thank you though.

EDIT: It worked! I needed to merge the intents since they were identical and causing a confusion. It works now after i’ve merged them.

Mentioned solution page dos’t exist, could you please share the solution?

2 Likes

@GauravRoy48 can you share the solution here. The link does not exists and its kinda urgent!!