Saturday, December 8, 2018

Best way of Customizing Your Api.ai Assistant with Context and Intent

Leave a Comment
Best way of Customizing Your Api.ai Assistant with Context and Intent 


If you are interested in learning more about AI, then for your AI AI feeling, see our screencast Microsoft Cognitive Services and Text Analytics API.

Best way of Customizing Your Api.ai Assistant with Context and Intent


Api.ai is a very simple service that allows developers to create their own personalized Ai Assistant / Chatbot that works like an Alexa of Siri and Amazon. How did I recently build my AI Assistant using API, where I showed the basics of establishing AI Assistant and teaching it some basic things. In this article, I want to go one step ahead and present "intentions" and "references", there is a way to teach our AI assistants another specific task to personalize their specific needs. This is where things can be really exciting.

Note: This article was updated in 2017 so that the recent changes can be reflected.


Good Building an AI assistant with Api.ai:
This post is one of a series of articles aimed at helping you achieve a simple personal assistant running with APIs:

You can also Read this AI Article:



What is an right Intent?
An intent is a concept that will be able to understand and react to a specific action. An intent contains a range of contexts that we can enter as sentences that the user has to say to our assistant. A few examples could include "Order me lunch", "Show me today's daily Garfield comic strip", "Send a random GIF to the SitePoint team on Slack", "Cheer me up" and so on. Each of those will be custom intents which we could train our assistant to understand.

Creating an right Intent:
To create an intent, log in to the agent that you want to add new functionality to the API console page and click on the "intend" button next to the heading "intent" on the top of the page or in the " Intentions "plus icon:



The sample objective for the assistant of this demo is to teach our assistant to excite people when they are feeling with movie quotes, jokes and other things. To get started, call "I have to say" a new intention and write your first trigger sentence under "The user says". The first sentence given below is "make me happy" Press the Enter key or click "Add" to add your sentence:



Generally, there is a series of different ways that we can say the same thing. Add them to a series of statements in the account, which represent various methods that users can indicate that they want to get excited, like "smile to me" and "I feel unhappy":



Now there is a sentence for many sentences to understand the helpers, but you have not said that when it listens then action is expected. To do this, create "Action". The Assistant will return the "Action" name back to your web app to allow it to respond.

In this case, you will not respond to the first verb called "chemup", but it will be easier in the future when answering the actions in your web app. I always recommend including action names for your intentions.



You can also add parameters to your works, but I will cover it in detail in my next article at Api.ai!

Direct Guiding Via Speech Response:
Your user has told the agent that they want to be excited, you want to direct the conversation to the user, tell the agent whatever you want. Intelligence helps to confuse confusion by limiting how much this chatbot needs to be handled. To do this, you provide speech feedback in the form of questions within the "speech feedback" section. For example, "Let's make you happy! Do you want a joke or a movie quote?"



Finally, click on the "Save" button next to your desired name to save your progress.

Testing Your Agent:
You can test your new intentions by typing a test statement in the test console on the right. Test it by saying "make me happy":



The agent responds with the intention of one of your trained responses. Once the phrase is provided, Api.ai learns! After this you will find variations on the phrase of the statement. As a result, your intention is also going on as a result, "Please give me a smile", "Say something smiling to me" or "I feel sad"



These differences seemed to trigger only after using the original phrase with the trigger. I'm not sure if it takes time to produce an understanding of similar phrases, but if any difference does not work, then first try to ask basic details. If your diversity is very different, then you have to add it to the statement of reference. The more statements you add here, the better our agent will be able to answer.

One thing you can see if you used a statement "I am sorry to hear this! How can I help you feel better?" It is that it is not specific enough to guide the user. If they are not aware of the options of "movie coat" or "joke", then they can ask for something that you have not covered! Over time, you can train your agent to understand many other concepts. However, for now I recommend to be specific with your questions!

Using Best Contexts:
By guiding the conversation with your speech feedback, your agent needs to follow the matter when the conversation occurs when the user speaks further. If a user says "a joke" or even "either one" without any prior conversation, the sentence can not be clear to give the agent feedback outside the context. If I talk to you and just say "a joke" how would you react? At this time your assistant will be given, because there is no way to remember that the conversation was moving forward first.

This is where the setting references in Api.ai come. We make reference to find out what the user and agent are talking about. Without references, each sentence will be completely separated before that.

To make a reference, click on the "Define Context" link at the top of the Api.ai console for your intentions:



Here you will have a section for input references and a section for output references. Input refers to the agent in which reference should be intent. For your first intent, you want to run it at any time, so leave the input reference blank. The output references intend to be raised in future messages. This is what you want:



Now create an output reference named "cheering-up". When naming a reference, Api.ai suggests an alphanumeric name without spaces. Type in your reference and press the Enter key to add it. Then click "Save" to save your changes:



If you check your agent once again by saying "make me happy", the result shows that your reference is still visible:



Filtering Intents With Contexts:
Your agent now understands that the conversation of "enthusiasm" is a reference. Now you can only establish an intention to run when it is referenced. For example, question your agent - create a potential response for "a movie coat". Go back to the menu on the left and click the plus icon to create a new intention:



Call your intentions "Movie Quotes" and set the input reference to "cheering-up". It tells your agent that only our users should accept this feedback if they had previously asked to be excited. We add some sample methods that users can say "I want a movie quote":



Then scroll down and include a series of more movie quotes in your feedback (feel free to include your favorites):



To make your movie quote purpose, click once again on "Save" next to the name of your intent. Then try to enter "Test me up" in the Test console next to it and follow it with "Movie Quotes". Agent should now say you a movie quote!

Then you can follow the same procedure to add a response to the "one joke" intent.

You are not required to provide your agent with a list of hardcode responses. You can instead set an action name for each purpose and respond to that action within your web app. This is another concept which I will include in future articles! You can be ready for future additions by giving an action called "cheermeup.moviequote" to your "movie coat" (the dot helps you to ensure that the action will take you to the normal "moviequote" action of any future you added Is not mixed with).

In Action:
If you have added these intentions in the same personal assistant used for your web app in the previous intention, then new functionality should automatically appear! If you made a new one, you must first update the API key in your web app. Open your personal assistant web app in your web browser and try it by asking your assistant to ask:



Then, tell it that you want a movie quote and see what happens:



Then, tell it that you want a movie quote and see what happens:

Conclusion:
There are several ways to personalize your assistant and use the concepts of contexts. Chances are there are some ideas already in your mind! To identify concepts (which are known as institutions) within our custom intentions, we can do more to train our API assistants, which we include in the next article in this series!

If you are following and using your personal assistant using Api.ai, then I would love to hear about it! What custom intention did you come from? Please tell me in the comments below.


If You Enjoyed This, Take 5 Seconds To Share It

0 Comments:

Post a Comment