Cloud
Studio Interface
Library

Library

Part of the Botpress NLU (Natural Language Understanding)

The second tab of the Explorer panel is the Library. Here you will find your global Intents and Entities. In addition to global Intents, Botpress provides Inline Intents that can be defined on a Transition.

Intents

Recognizing the meaning of user messages is essential. It’s critical not only to identify them, but also accurately classify them. To do so, you can program your chatbot to extract information from a natural conversation (i.e. a conversation with a human).

When you create an intent, you also add utterances. Utterances represent the different statements your user can use to say or ask for the same thing.

You can also use them as inline intents for transitions.

For example, we can add the following utterances to the “Ordering a coffee” intent:

  1. I want coffee
  2. I'd like some coffee, please
  3. Do you have a decaf espresso?
  4. Hi. I'd like to order a latte, please. Normal, single shot.

You can add these different utterances to train your chatbot to answer an intent instead of a specific word. The user statements are compared and matched with the most appropriate intent with the highest confidence score.

User MessageIntent MatchedConfidence
I would like to order a coffee.place-order0.97
An espresso, pleaseplace-order0.91
Can you please give me a double cappuccino?place-order0.96

Adding an Intent

To create a new intent,

  1. In your Conversation Studio, click the Library tab from the top left corner.
  2. Click the + button.
  3. Give it a friendly name.
  4. Click Submit.
  5. Write your utterances next to the number (where you can see type a sentence).

Note
Utterances currently have a maximum of 280 characters.

Entities

You can think of Entities as intent parameters. They represent a concept such as a colour, a date, a time, or a weight. Entity extraction helps you extract and normalize desired entities if they are present in a user phrase or message to the chatbot.

Example: The place-order intent contains the following entities: caffeine that specifies if the coffee is caffeinated or decaffeinated. size for a single or a double shot. drink that specifies the kind of drink asked. Attached to NLU extraction, you will find an entities property which is an array of System and Custom entities.

Custom Entities

Botpress provides two types of custom entities: pattern and list entities. To define a custom entity, go to the Library tab of the Explorer. From there, you can define your custom entities which will be available for any input message treated by your chatbot. Go ahead and click on New entity.

Using Entities

You may access and use entity data by looking up the event.nlu.entities variable in your hooks, flow transitions or Execute Code cards.

List Entities

List extraction behaves similarly to pattern extraction. However, you'll be able to add different occurrences of your entity with corresponding synonyms. Let's take Airport Codes as an example: Extraction will go like this: User said Type Value "Find a flight from SFO to Mumbai" "Airport Codes" ["SFO", "BOM"]

Pattern Entities

Pattern or Regular Expression Extraction allows you to extract information presented in a format that can be described using Regular Expression (RegEx). Once you've created a pattern entity, Botpress Native NLU will perform a regex extraction on each incoming message and add it to event.nlu.entities. Example: Given a Pattern Entity definition with [A-Z]3-[0-9]4-[A-Z]3 as a pattern: Extraction will go like this: User said Type Value Find product BHZ-1234-UYT SKU BHZ-1234-UYT