# Basic Introductory Guide

In this guide we make an introduction to Moveo.ai and explore the basic but powerful capabilities that our platform provides such that you can create an intelligent AI Agent!

## Scenario#

Assume that you own an online store and you would like to build a Virtual Assistant, which has 2 functions. It greets the users and can assist users to make online payments. Thus, in this example, we will create two Intents that deal with the aforementioned functions.

## Step 1: Create a Brain#

The first step is to create a new Brain, which will serve as the logic of your Virtual Assistant. To do so:

1. Click on Brains on the left-hand sidebar
2. Click on Create a Brain
3. Come up with a Name, Description and Language
4. (Optional) Import an already exported brain
5. Click on Create

Note that the Brain has status: Unavailable because it does not contain any data yet, and hence cannot be used.

## Step 2: Intents#

After the Brain was created, let's create the two Intents, which will consist of a few natural language expressions each and will give the Virtual Assistant the ability to understand the user's messages and classify them correctly. As mentioned above, the two Intents in this example will be:

1. greetings: Understands messages that greet the Virtual Assistant, like 'Hello', 'Hi, how are you?' etc.
2. payment: Understands messages that express the desire to make a payment, like: 'I want to make a new payment', 'How do I pay?', etc.

After creating the two Intents, our Brain looks like:

## Step 3: Initial Dialog#

Now that our Virtual Assistant can understand the above 2 Intents, it is time to create the Dialog, which will provide answers to the users depending on their messages. As an initial step, we will create 2 dialog nodes. The first one will answer to user's who greet the Virtual Assistant and the second one will deal with questions regarding making a new payment.

As we can see from the pictures below each dialog consists of a Text Trigger that is connected with an Intent and various Responses. A Trigger is activated only when the Virtual Assistant classifies the user's message as the Trigger's corresponding Intent. For example, the message Hello! will be classified from the Virtual Assistant as the Intent #greetings and hence the Trigger connected with #greetings will be activated. When the Trigger is activated, its Responses will be shown to the user.

## Step 4: Requisites#

So far we have provided a simple and smooth interaction with the user. However, most stores would want to collect some information from the users, such as their first name and their email. The most common way to extract information from the users is through Requisites.

Let's add two Requisites in the Greeting Node in our dialog, such that we ask for the users' first name and email. This information will be saved as Context Variables and can be referenced in our Responses or used from a Webhook.

In general, Context Variables are temporarily stored and can be used for the duration of the specific interaction with the user. If the need for permanent storage is required, it is suggested that a Webhook sends the Context information to your own System.

In the images below, we use the Context Variables $firstname and $email to store the user's first name and email respectively. We also reference $firstname in our Text Response like {{$firstname}}.

Also note that the type field of the email Requisite is set to the predefined Email, which understands if the user's message contains a valid email. For example, we can see in the Chat Mistake image below, that the user made a mistake when providing his/her email. In this case, the Virtual Assistant will ask again.

## Step 5: Events#

Of course, we may have the need to properly greet the users and give them a few details of how they can interact with the Virtual Assistant! Having the requisites in the initial Greet Node does not give us this capability. Event Triggers allow us to break up the dialog into smaller parts that can be connected together by Event Responses. In this case, we can properly greet the user in the initial Greet Trigger Node and after that collect his/her first name and email. The Dialog that collects the information will consist of an Event Trigger with the same Requisites as in Step 4 above.

## Step 6: Optional Requisites#

Now that the Virtual Assistant can adequately greet the user and collect a few personal information, it is time that we construct a little more complex experience with regards to submitting a new payment for our online store. More specifically, our store can accept payments by card or by PayPal.

The desired experience would be to explicitly ask the users how they would like to pay only if they have not previsously mentioned it. For example, for a user's message 'I would like to make a payment' the Virtual Assistant should answer 'How would you like to pay?'. However, for a user's message 'I would like to pay with my credit card', the Virtual Assistant should redirect the user to the website that receives card payments.

Let's initially create a Dialog, which understands if the user has specified a payment time and respond by referencing it.

The first step would be to create the two relevent Entities for card and Paypal payments. We can see from the image below that these entities are named @card and @paypal respectively.

The second step is to add two optional Requisites to the Text Trigger with a if no requisites, else field.

• The question inside if no requisites, else field will only be asked if none of the two entities referenced by the check for fields in the requisites are present in the user's message.
• If the user's message contains any of the entities referenced by the check for fields, then the question inside if no requisites, else field will be skipped. In this case, the context variable in the save as field will be populated by the entity inside the user's message.

From the images above, we can see that we can create a natural interaction with the users, by only asking their preferred payment methods if they haven't specified it.

## Step 7: Conditions#

In Step 6, the response that the Virtual Assistant gives to the user is very generic. The Virtual Assistant does not take into advantage the fact that the user has specified his/her preferred payment method. One way we can take advantage of Context Variables is by adding Conditions, which provide a different dialog flow depending on the previous steps in the conversation.

In this step, we will provide a different answer to the users, depending on their preferred payment method. we will keep the same format as Step 6 except for the Response part, which will depend on the \$payment_method Context Variable that was saved from the two optional Requisites.

## Step 8: Multilevel Dialog#

As the last step in this example, we could make certain additions to take care of the problem where the user specifies a payment method, which is not supported by our online store. As we saw in the example above, if the user specifies cash as the preferred payment method, then the Virtual Assistant does not understand and the conversation reaches a halt.

To solve this, we can create a new Dialog, which will ask the user if he/she would like to try specifying the payment method again, such that the Virtual Assistant can give them assistance. This Dialog will consist of an Event Trigger and will be activated from the Else Condition of the above example.

Also, this Dialog will ask the user if he/she would like to try again, and thus expect a Yes/No answer. To be able to capture that, we will create an #affirmative and a #negative intent.

In the Event Dialog Image tab below, we can see that the way we capture the Yes/No answer from the user is by adding two seperate Triggers below, namely the Affirmative Trigger and the Negative Trigger. This structure will allow the Virtual Assistant to ask the question defined in the Text Response 'Would you like to specify your payment method again?' and pause in order to wait for the user's answer. Once the user gives his/her answer, it will be classified as one of the Intents in our Brain. If the classified Intent is #affirmative or #negative the Affirmative Trigger and the Negative Trigger will be activated respectively. Otherwise, the Virtual Assistant will try to trigger a Dialog which has as a parent node a Trigger that is connected with the classified Intent. For example if the classified Intent from the user's answer was #greetings, then the Virtual Assistant would activate the Dialog which has as parent node a Trigger that is connected with the Intent #greetings.

Last updated on