Skip to content

API.ai node

Guidone edited this page Aug 3, 2017 · 1 revision

Use Api.ai NLP engine to parse user input. With Api.ai it's easy to parse sentences like "I want to switch on the lights of the living room" and extract key variables.

Some Api.ai terminology:

  • Context: have the same meaning of topic in RedBot (do not confuse with chat context in RedBot), the purpose is to restrict the working area of the parsers based on a context of the sentence. For example the words "the email is an_email@gmail.com" can trigger a particular action it the user is signing up with the chat bot (for example topic or context "signup") and a different one if the user intention is to send an email to someone with the chat bot (for example topic or context "send_message")
  • Intent: is a set of rules for parsing user's sentences and detect a set of entities in order to consider the sentence complete. For example in the sentence "I want to switch on the lights in the living room", the entities are Furniture (lights), OnOff (on) and Room (living room). By setting these entities as mandatory to consider the sentence complete, the Api.ai intent is able to parse them and ask question if the sentence is missing some information (for example after "I want to switch on the lights" it could ask "In which room?"). When the sentence is complete the Intent changes the context/topic, for example to "switch_lights", in this way it's possible to let RedBot takes action for this context.
  • Entity: are sets of objects of the same class. For example in a sentence like "I want to switch on the lights in the living room" the entity Room can contain: living room, kitchen, lavatory, etc

The Api.ai node works like a kind of loop: the first output is always connected to a message node, this allows the Api.ai node to keep asking question to the user until all the intent requirements are met.

When the sentence is complete and Api.ai transitioned to a new topic (context) the message is forwarded to the proper output based on the matched topic (just like the Topic node).

Telegram Facebook Slack Smooch

Clone this wiki locally