Understanding Slots in Stories

I struggle to understand the usage of Slots within stories. I read the blog about it and there is this example:

I dont understand this line:

* inform {"email":"example@example.com"}
    - slot{"email":"example@example.com"}

First of all, what does the inform {“email":"example@example.com”} line even mean? According to Usage of slots in stories the second line (slot{“email":"example@example.com”}) acts as a conditional check if the slot email is set to a value, so what does the first line do?

Also I don’t understand how the slot email can be used in the first line, when the SlotSet-Event is defined one line later.

Can someone clear me up?

Thanks in advance

It means that the user wrote a sentence with the intent “inform” and provided the slot “email” with the value “example@example.com”.

Rasa uses the intents and values of categorical slots to determine the context and select the bot response.

Ok, I got this, but if we already know that the user wrote a sentence with the intent “inform” and gave a value to the email-slot within that sentence i dont understand the second line

- slot{"email":"example@example.com"}

We already know the slot has a present value, so why this second slot-line?


In the event that your NLU picks up the entity “email”, and your domain has a slot with the same name, ‘email’, the slot will be set automatically. In that case you won’t have to include the slot statement in your stories

Hi there, The way I understand it, the line inform is the intent inform with the entity email and the value example@example.com

The line slot actually stores the value of the recognised entity in the slot with the same name.


Nice… I think finally understood it :slight_smile:

 * inform {"email":"example@example.com"} <!-- Predicted inform, email-slot is (virtually) set-->
    - slot{"email":"example@example.com"} <!-- Actually set the email-slot-->


* inform {"email":"example@example.com"} //this line is just condition that the and here "email" means entity
    - slot{"email":"example@example.com"} // this is for setting slot "email" 

in rasa entity and slots are two different things if name of entity and slot is same there is no need to specify the -slot{“email":"example@example.com”} but if names for slot and entity are different then second line plays important role

1 Like

Almost, the line inform doesn’t set virtually a slot. As @tusharvpatil wrote it is a condition needed, that the NLU identifies the intent inform and the entity recogniser gets the entity email. Here the bot knows what the intent was and that there was a recognised entity but the bot uses slots as internal memory to save the entity values.

The process of the bot storing the recognised entity in its internal memory (for using it latter) happens in the slot line.

In principle, you don’t need to save the recognised entities if those values aren’t important, that’s why in the domain file you can specify if an intent uses or not an entity.

Hope that helps.

1 Like