1. Home
  2. Docs
  3. Tutorial: Building an agent on over.ai
  4. Building a Conversational Flow
  5. Using Entities

Using Entities

We can use Entities to store lists of values and their synonyms, which allows us to have the agent validate a user input against a selected Entity. We will make an Entity that will allow our agent to verify the user’s input for pizza size.

Key Term: Entity Entities are used to extract and validate pieces of data from a user’s natural language input. System entities are built into the agent, but you may create custom entities for your agent as well. Syntax: @entity

  • In the left navigation, click on Entities
  • Click Create New Entity in the top right
  • Name the entity “size”
  • Add the values “small”, “medium”, and “large” — you can also add synonyms to each value to help the bot identify more types of inputs (i.e. synonym for “large” can be “big”)
  • Save the Entity

Now we will go back into the intent order.pizza, and select our new entity for the pizza size.

  • Return to the order.pizza intent
  • Scroll down to Parameters
  • In the SIZE parameter, choose @size from the Entity dropdown menu
  • Save the intent order.pizza

Great! Now our agent will know whether or not the user gives a valid size as an answer. If not, because we checked the Required box, the agent will rephrase the question until it receives a valid response. If no valid response is achieved, we can add in a secondary parameter prompt by adding a prompt variant within the parameter, designating the secondary prompt with an asterisk at the beginning.

  • Return to the order.pizza intent
  • Scroll down to Parameters
  • In the parameter size, add the prompt variant “*We only have small, medium, and large. Which would you like?”
  • Save the intent order.pizza

 

TIP: In the Expressions section of an intent, you can highlight part of an expression to make your bot understand which part of the expression is the entity. You will be able to select from the list of available entities. If the highlighted section is included in any particular entity, you will have an option to select the entity with the parameter value (@entity:PARAMETER), and your agent will assign the highlighted section as the parameter value and will know to skip that parameter prompt. Selecting an entity without an attached parameter value will create a new parameter.