What Are Chatbot Slots, and How Do You Define Them for Your Bot?
Chatbot slots, also known as entities, are variables you give your program to let your bot categorize and interpret users’ input. Read on to learn more!
February 12, 2019
If you’ve read our article on intents, you already know how to plan for the kinds of things your users will say when they chat with your bot. But what about the content of those things? For example, if you know that your user is giving a #dog_breed_suggestion intent, how can your bot actually suggest the right dog breed?
That’s where slots (also known as entities) come in.
What are chatbot slots?
Slots are the variables you give your program to let your bot categorize and interpret users’ input. If your user says, “I want to order a pepperoni pizza,” your bot first has to understand that the user is asking for an order. Next, to narrow down what kind of suggestion it should give, it finds the slots in the sentence.
In our pizza example, your bot would identify the statement as a #place_order intent with an @pizza_type slot and a “pepperoni” value. (We’ll get into what all that means in the next section.) From there, your bot can place the order for the correct pizza and then respond to the user with payment and order details.
Ultimately, slots let your bot filter what types of answers will match your user’s intent and subsequently choose the correct response.
How are slots structured?
When you design slots for your bot, they should have three parts:
The slot part itself is fairly generic. It serves to separate user input into broad categories. And, just like with intents, natural language processing (NLP) services help you to define which slots your bot should watch for and respond to.
If you remember, intents in most NLP services are defined with # signs. Slots are usually preceded by an @ sign (depending on which NLP service you use).
Examples of slots
After you have the slot itself figured out, you can move on to the other two parts: values and synonyms. Values are examples of the slot you’ve defined, and synonyms are other ways that users might express that same value.
The more synonyms you add, the better. Unlike with intents, NLPs are not very good at figuring out what slots a user is using unless they’re included as a value or a synonym. Some NLPs, like Watson from IBM, are currently testing fuzzy logic features that do a better job of identifying unique slots. For now, though, it’s still best to add as many synonyms as you can.
How to choose built-in slots wisely
NLP services allow you to enter whatever slots you want, along with their values and synonyms. Most systems also give you built-in slots that you can easily enable. Slots for date, time, and currency are already done for you, so you can add in whichever ones make sense for your bot.
Built-in slots will always begin with a specific prefix, usually @sys. But some NLPs may structure them differently. For example, wit.ai writes its slots as ###wit/(slots). So you’ll see things like ###wit/temperature or ###wit/on_off. Whatever prefix your NLP uses, just make sure you don’t begin your self-written slots with the built-in slot prefix.
Because you need slots so that your bot can respond to user input, you might think the more slots the better and that you should enable every system slot in the book. Not so. Crowding your bot with unnecessary slots doesn’t equate to a better user experience.
Use only the system slots that fit your specific bot. If you have a bot designed to tell people the weather, the @sys-currency slot is probably unnecessary.
How to decide what slots your bot really needs
Start with your intents. If you’ve done sufficient user research for your intents, they should tell you which slots you need.
For example, if you have a bot to help people buy shoes and one of your intents is #shoe_options, you know you’ll need slots like @shoe_type with values like “sneakers” and synonyms like “tennis shoes.” So, when your user says, “Show me some tennis shoes,” your bot will identify it as a #shoe_options intent with a @shoe_type slot and a “sneakers” value.
Although it’s true that you shouldn’t crowd your bot with slots that have nothing to do with its function, you should make sure that you have enough applicable slots (plus values and synonyms) that your bot will be able to understand your users and respond to their needs.
What comes next?
After you’ve finished designating intents and slots, you can start to design your bot’s utterances (the way it talks). Find out more about utterances.