Constraining Slot Values
In this short lesson we explain why you might want to use forms to set slots. It turns out that entities can be detected innapropriately and we need to constrain our data collection to only collect when it's appropriate.
Video
Code
Let's consider our settings in our domain.yml
file once more.
entities:- shirt_size
slots: shirt_size: type: text influence_conversation: true mappings: - type: from_entity entity: shirt_size
Suppose now that a user, during a conversation, says; "I feel medium today. Kind of sad"
.
Then the token medium
is mapped to the shirt_size
slot even though the user wasn't
declaring a shirt size. This means that we need to be careful when we allocate an entity to
a slot. We may only want to do that when we're actively asking for a specific value.
This is why we may want to start using forms to set slots. It will allow us to structure the way that we ask for information and it will also allow us to add conditions to our slots that prevent the behavior in the video.
Links
Exercises
Try to answer the following questions to test your knowledge.
- Can you think of other slot values that may be set innapropriately?