We're excited to announce the experimental release of conditional response variations, now available in Rasa Open Source 2.6. Conditional response variations allow your assistant to serve the end user a different response based on slot values, creating personalized conversations. This enables an assistant to reply to the user with a special response if a customer's subscription tier is Premium
, a user's location is Canada
or a customer's upgrade eligibility is true
.
In the past, creating conditional responses required custom actions or multiple stories. With this release, conditional response variations can now be defined in the domain.yml file, reducing the number of stories needed and allowing non-developers to define conditional responses without writing code.
Defining conditional response variations
Conditional response variations look much like regular responses, but with one important difference. In addition to the text of the response, a response variation also contains a condition key.
responses:
utter_greet:
- condition:
- type: slot
name: logged_in
value: true
text: "Hey, {name}. Nice to see you again! How are you?"
The condition includes the name of the slot as well as the value that makes the alternative response eligible to be used. In the example above, the response "Hey, . Nice to see you again! How are you?" is used only when the logged_in
slot is set to true
.
Because conditional response variations are listed in the responses
section of the domain.yml file, it's easy for conversation teams to see at a glance which responses the assistant can utter and how they depend on context stored in slots. This allows non-developers to play an active role in creating and managing dynamic responses.
Creating personalized conversations
Slots can be set in several ways: by the NLU engine, when a matching entity is extracted, and programmatically, by custom actions. To put it another way, a slot can contain information from something the user has said, or it can contain information fetched from an API, database, or calculation. This versatility makes conditional response variations very powerful because responses can be conditioned on a wide variety of data.
For example, you might condition a response based on a customer's account level, churn risk, or rewards point balance-all slots that could be filled by integrating with customer management systems. Slots filled with entities can be useful for leveraging information the user has provided during the conversation. For example, if a customer has specified that they want to book a business-class plane ticket, you might want to offer a special deal to upgrade to first class. Or if the customer mentions that they are a vegetarian, you might want to offer a meatless menu. Conditional response variations can be applied towards many use cases and situations, allowing developers to build assistants that offer a higher-value user experience through personalization.
FAQ
What happens if two conditional response variations are eligible?
It is possible for multiple conditional response variations to be eligible if multiple slot conditions are filled at the time of response prediction. When this happens, one of the eligible response variations will be selected at random.
Can conditional response variations be defined in Rasa X?
Conditional response variations are an experimental feature, and we're still in the process of gathering feedback and iterating. As development progresses, we expect to add Rasa X support in future versions. If you have suggestions for improving conditional response variations, you can create an enhancement request on GitHub.
Conclusion
To get started with conditional response variations, upgrade to Rasa Open Source version 2.6 and above, and check out the docs for more details and code examples. For more information, you can also catch our recent June episode of Beyond the Release Notes, where Rasa Machine Learning Researcher Chris Kedzie shared his latest work on this feature.
We're curious to learn more about your use cases for conditional response variations and hear your suggestions for making this feature even better. Share your feedback and continue the discussion in the Rasa forum.