Slots not cleared after starting convo again

Hello, I’m building a chatbot to check whether a user has access to a set of projects and databases.

The bot will ask for 2 slots for the form if the message doesn’t include those already reporting_type (project or database) id (of project / database)

After the form has been filled and actions have performed, it’ll ask if you need more help If yes, then it’ll restart the process asking for what project / database you need to check access to

I’m running into an issue where the slots are not cleared after you restart the conversation. When you talk to the bot the 2nd time, it won’t ask for the reporting_type and id even if you don’t provide them anymore because they are still “filled” from the previous conversation

Here’s my domain.yml

version: "2.0"

intents:
  - greet
  - affirm
  - deny
  - goodbye
  - out_of_scope
  - nlu_fallback

  - check_access
  - inform

entities:
  - reporting_type
  - id

slots:
  reporting_type:
    type: categorical
    influence_conversation: false
    values:
    - project
    - database
  help_type:
    type: any
    influence_conversation: false
  id:
    type: any
    influence_conversation: false

responses:
  # Defaults
  utter_greet:
  - text: Hey!
  - text: Hi there!
  - text: Hello?
  - text: Hi!

  utter_goodbye:
  - text: Bye now
  - text: C u later alligator :)
  - text: Bye and have a great day!

  utter_default:
  - text: I don't think I understand. Can you try providing more detail or rephrasing it?
  - text: Um, can you rephrase that again for me?
  - text: Beep, boop, don't understand. Please rephrase

  utter_please_rephrase:
  - text: I'm sorry, I didn't quite understand that. Could you rephrase?
  - text: Can you rephrase what you just said please?

  utter_help:
  - buttons:
    - payload: /check_access
      title: Check my access
    - payload: To be added
      title: To be added
    text: "You can ask me things like:\
      \ \n- Do I have access to project <id>?\
      \ \n- Please check my access\
      \ \nOr select from the options below:"

  utter_start_help:
  - text: Sure let me help you with that!
  - text: Yes I can help you with that!

  utter_check_access:
  - text: Give me a min, let me check...
  - text: Just a moment...
  - text: Yeah give me a min and I'll check that...

  utter_did_that_help:
  - text: Did that help you?
  - text: Did that help?
  - text: Was that helpful?
  - text: Hope that was helpful to you?
  - text: Was that what you needed help with?

  utter_ask_check_access_form_reporting_type:
  - buttons:
    - payload: /inform{{"reporting_type":"project"}}
      title: Project
    - payload: /inform{{"reporting_type":"database"}}
      title: Database
    text: And I am looking at your access to which one here?

  utter_ask_check_access_form_id:
  - text: What's the {reporting_type}'s id?

forms:
  check_access_form:
    required_slots:
      reporting_type:
      - entity: reporting_type
        type: from_entity
      id:
      - entity: id
        type: from_entity

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true

nlu.yml

version: "2.0"

nlu:
  # Defaults
- intent: greet
  examples: |
    - hey
    - hello
    - hi
    - hello there
    - moin
    - hey there
    - let's go
    - hey dude
    - yo bud
    - yo
    - sup
    - how are you
    - how's it going

- intent: affirm
  examples: |
    - yes
    - y
    - indeed
    - of course
    - that sounds good
    - correct
    - exactly
    - yep
    - ya

- intent: deny
  examples: |
    - no
    - n
    - never
    - I don't think so
    - don't like that
    - no way
    - not really
    - nope
    - wrong

- intent: goodbye
  examples: |
    - cu
    - good by
    - cee you later
    - good night
    - bye
    - goodbye
    - have a nice day
    - see you around
    - bye bye
    - see you later

- intent: out_of_scope
  examples: |
    - mmm I can't see what you're saying
    - I am looking forward to my best friend's wedding. Do you have any tuxedo's?
    - hmmmm
    - Can I?
    - Well, okay then
    - what is the square root of 5
    - I want to know the weather
    - what is the meaning of life.
    - Fridge Isn't Running
    - my tv isn't working
    - I want a pizza
    - my washing machine isn't working
    - what year is it
    - order a pizza
    - I want to order a pizza
    - what is the weather today
    - what is the weather
    - why is the sky blue
    - blah blah blah

# Ziplabs
- intent: check_access
  examples: |
    - Check my access
    - I need to open this [project](reporting_type) [123](id)
    - Do I have access to this [db]{"entity":"reporting_type","value":"database"} [5](id)?
    - Can I open this [project](reporting_type) [91](id)?
    - Do I have permission to open [db]{"entity":"reporting_type","value":"database"}?
    - access to this [project](reporting_type)?
    - I can't open [project](reporting_type) [55673](id)
    - I cannot access this [database]{"entity":"reporting_type","value":"database"}
    - What is my access?
    - Access
    - Can you give permission to open this [db]{"entity":"reporting_type","value":"database"} [4914](id)?
    - Please grant me access to [project](reporting_type)
    - Why can't I open [db]{"entity":"reporting_type","value":"database"}?
    - I need help accessing this [project](reporting_type)

- intent: inform
  examples: |
    - it's [91234](id)
    - 12331
    - it's 123
    - wait actually that is wrong. it should be 564

- synonym: database
  examples: |
    - database
    - db

rules.yml

version: "2.0"

rules:

- rule: intro
  steps:
  - intent: greet
  - action: utter_greet
  - action: utter_help

- rule: respond to chitchat goodbye
  steps:
  - intent: goodbye
  - action: utter_goodbye

- rule: out of scope
  steps:
  - or:
    - intent: nlu_fallback
    - intent: out_of_scope
  - action: utter_default

stories.yml

version: "2.0"

stories:
- story: Want to check access
  steps:
  - intent: check_access
  - active_loop: action_deactivate_loop
  - active_loop: null
  - action: utter_start_help
  - action: check_access_form
  - active_loop: check_access_form
  - active_loop: null
  - action: utter_check_access
  # Custom action to check access here
  - action: utter_did_that_help
 
- story: Did that help Yes
  steps:
  - action: utter_did_that_help
  - intent: affirm
  - action: utter_goodbye

- story: Did that help No
  steps:
  - action: utter_did_that_help
  - intent: deny
  - action: utter_help

Welcome to the community :slight_smile:

Set this to false

So that only affects whether slots are carried over to a new session or not after the session timed out.

In my case, if you answer “Yes” when asked “Do you still need help”, then you’ll start the conversation again. From some Rasa demos, that flag is still set to true but slots are cleared as expected.

Ah that’s what you mean by restart.

Is this the story you’re talking about?

You can change it to:

- story: Did that help No
  steps:
  - action: utter_did_that_help
  - intent: deny
  - action: action_help

In action_help, you can return [AllSlotsReset()] to reset all the slots, or return [SlotSet('slot1', None), SlotSet('slot2', None), ...] to reset some slots.

Ah got it thanks!

1 Like