When creating a slot in Rasa, is it also important to declare the slot as an entity?

741 views Asked by At

Lets say I create a slot in Rasa called "yearlybill".

I will have to write:

slots:
  yearlybill:
    type: float
    min_value: 0

So my question is, when I want to use these slot in my intents, will I have to explicitly mention it as an entity as well? Or is that option?

1

There are 1 answers

0
cantdutchthis On BEST ANSWER

Let's start with a bit of background.

A slot should be seen as a long-term memory slot. You can store information in there manually, via a custom action, without having an entity around.

An entity is a substring of the user message that you'd like to extract for later use. Common entities are names, dates, and product-ids. It's very common to store the entity in a slot, but you don't have to. You can also detect an entity and have a custom action retrieve that information from the tracker.

You could define a slot without defining an entity. If you're planning to use a custom action to fetch the slot value from a users' text, you technically don't need an entity. This isn't a common pattern though. Typically you'd like a specific entity detection model to fetch the entity so that it can be stored in the slot after. That's why it's common to see domain.yml files that contain both a slot and an entity definition.