Select responses based on slot presence

Hello, I want to use response variants with and without a slot variable. Expectation is that when slot is not populated then response selector will pick response variant that does not include variable. And vice versa. I have found in the documentation that if slot is not populated then None will be filled. I do not find this behaviour very usefull because users do not typically want to see None, undefined, nil and similar technical words.


  - intent: who_is_home
    examples: |
      - Is somebody home?
      - Who is home?
  utter: home_presence:
  - There is nobody at home.               <--- This variant to be selected when {person} == None
  - {person} is at home.                        <--- This variant to be selected when {person} is populated.
  - {person[0]} and {person[1]} is at home.   <---  Nice to have

What is the best practice to deal with this? Thank you

You can create a custom action that will output the correct phrase

Thank you, Vladimir. I was hoping there is an easier solution. Like the one I described :wink: Isn’t this a common pattern? Is there a chance Rasa will consider this as a feature request? Hardcoding bot responses in actions python code apart of all other responses in domain file is not a good practice.

please create a feature request issue on GitHub