How should stories be if slot_was_set in custom action_session_start

Hi:

I have set a slot in my custom action_session_start and I want to implement branching logic based on this slot and a broad intent at the beginning of the session.

slots:
  business_domain:
    type: rasa.shared.core.slots.CategoricalSlot
    initial_value: null
    auto_fill: true
    influence_conversation: true
    values:
    - flight
    - special_car
    - hotel
    - train
    - store
    - stages
    - taxi
    - corp
    - other

I have the following story now, but it doesn’t work:

- story: ticket refund(flight)
  steps:
  - slot_was_set:
    - business_domain: flight
  - intent: wanna_refund
  - action: utter_begin_flight_ticket_refund

- story: ticket refund(train)
  steps:
  - slot_was_set:
    - business_domain: train
  - intent: wanna_refund
  - action: utter_begin_train_ticket_refund

How should I fix the story?

@lynndisco are you able to share the code of your custom action and how you run it? Potentially you could try to see if adding the action step before slot_was_set works:

- story: ticket refund(flight)
  steps:
  - action: action_session_start
  - slot_was_set:
     - business_domain: flight
...

It would be helpful to see your entire stories file, I find it a bit strange to not have a story started with an intent. I’d also recommend you take a look at checkpoints, that could help you branch stories more easily?

Another more efficient alternative is to not use slot_was_set and checkpoints to branch stories, and instead to take advantage of conditional response variations: this way, you could have only one response (utter_begin_ticket_refund) instead of one response for each slot category value.

Thank you for your advice, conditional response variations helped me solve the problem.

Another thing I found, if multiple influence_conversation: true slots are set in the custom action_session_start, and some of them are used in other rules, then the story needs to be written with those slots as well:

I set supply_name , supply_gender , and business_domain to influence_conversation: true in action_session_start, and used supply_name and supply_gender in one rule.

Then I must use all 3 slots at the beginning of my story, if I just use business_domain alone then the story will not work.