Making of simple AI Chat Bot using webhook | Python | dialogflow.com | API.AI | ngrok

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
now we are going to create our first API AI now known as dialog flow using that we are going to create a AI chat bot so first you need to download Python from Python dot o-- r-- g-- I use Python 2 so you can download Python 3 also so download Python 2 and install it next I need to make a server so that the code runs for my computer and accessible fire web so next you need to download in G Rock ok so to download n 0 and the setup file you need to make sure you put it in the Python directory okay now you have to go to dialogue flow dot-com this is formally known as API dot AI next go to console after you log in go to console there you have to create a agent create new agent from here give a name to the agent this takes these various increase rate of banks okay associate with a Google project and click on save now you have got a agent bank interest rate rates and here the water rebuilt agent small talk here you need not worry about the small talk like hi hello like all these things if you type your hello an incredible small talk okay done after you keep done if I say hello the responses come in hi there friend again I say hello the response is coming howdy so I have implemented a simple chat bot which the tic-tac tic-tac talks does now you can see the sample examples here now we have to next we have to create a more complex agent in this agent only so we have to write a Python code and from that Python code we are going to send some requests and the Python code going to pushes that and return to this boot so now if I type federal bank interest rate this is nothing is coming sorry I didn't get that okay unruhe bank interest rate sorry I didn't get that or if I simply type federal bank so it is getting nothing okay so I need to create a intent with the line user can give or user can ask from that we have to take that entity and with that entity will process something okay suppose user says federal bank we have to first adhere entities okay we are going to add into this like bank Nance okay here are suppose Federal Bank of it so we have created entities and ninety-two values are this now we are going to create intent intent name you can give us a bank name bank interest rate and you need to you need to guess what user can save to your boat suppose it says federal bank interest rate okay now you can see it is automatically detecting the entity now I have to give a accent I am suppose I am giving Exynos interest okay and bank name is required otherwise it won't a boat alt proceed so this is required and what you both will say if I didn't give any bank name so it will say leave enter a bank name okay okay so I click Save over suppose I change the entity to bank then okay so in today already is in use no problem i this now I change this command clamp okay I didn't shave the previous one that will move save entity back then okay I'm glad I say Phil Phil this is federal bank interested back now to manually select the bank name because I have changed the entity name okay and action is interest click on save and it is required okay people say now each time I click Save you see this gear icon is rotating that when the agent is getting trained now if I search federal Mac response is coming as nothing because I have I didn't give any response again this I will what I will do I will send the parameter to a wave loop to my server and my server will process the request and it will return the value to this boat so open Python install Python you can create your Python code here or you could simply edit in your Python GUI and a Python Python editor or in notepad also here you need to create a new project to file under bank interest rate as app dot P Y and I have a habit of importing the URL library this is mainly used for web scrapping so happened that now we have to import all these libraries Justin always flux and you have to input all this libraries so here I am getting the post request as /wave hook and this also defining the route so I will define the wave book method I will print everything on my console the web server I will be running from my system so that if any error comes I can see that I will call a new function I will pass the request to make wave hook result and again I will print the address on my console and I will I'm preparing the response the header and all these things will be will be default response in headed this will be the this will be the things that takes place when I return a JSON response and finally I am returning our now I have to define the method make wave hook result so you remember that I have given action against the intent that interest so first I will check that the action is interest or not if the action is interest then only the next portion of the code will be executed or otherwise it will be returned so I am declaring a variable result and now I am getting the parameter which has been passed by the boat to this way book so now I will get the parameter bank name and the Bost has passed some value here I will declare a constant list that that stores the value against the bank name the value is the interest rate against the bank name I can give all the bank names here and the respective interest rate here this is I am doing this to show our example that how simple we can build a Chatwood the using that sends a request to a hook and gets back that response and prints it but here I can I can implement more complex things that using web scrap we're scrapping I can get the interest rate of federal bank from their website and dynamically I can handle everything and the values will be dynamically fetching from their site at regular interval and I don't have to change anything on regular basis on this program like I will sway with example in my next video that how you can fit the movie details using web scrapping and print in your chat board that what are the movies running currently and what does the movies are going to come we can do it using with scrapping so now we are just selecting we are declaring a constant value and speech equals to the interest rate of the parameter I have got bank name I will get the interest rate again that bank name so I am going to change it to bank and the parameter name to name okay so the interest rate of concatenation name means the interest rate of the I guess the boat has Center requisite the interest rate of Federal Bank is stream Bank name the interest rate against that Bank name we printed I am printing this on my console so that I can see on my server what are the things it is returning finally I will return speech the speech I prepared and for sequels to binders my program name bank interest rate now I'm going to declare a male I will dictate the port on which this Python code will be running on my local server and I will link this local server to the two online with web using in j-rock so that the boat can send request on my server local server and I will print that the app is on port the port five five oh and finally I will run the app that's the code the background logic for web hook as you can see I have written the Python code the way hook and the parameter name bank name and back name with same and the action is interest I need to check that if interest is action then only this code will be executed and now I will change the port to 80 I want to run this code on port 80 and my port 80 will be exposed to the width okay now click it time okay in common pump go to the Python right and from here you need to execute the code there was a syntax error okay I missed it s method and the server is running on it tick now you I have to connect it with the web I need to put on the injured rock the indie-rock server is running okay you can see from here this one is the link put is online and linking to my computer always running from my computer and you can see all the requests here open so click Save and now go to fulfillment only brainable the way book - ok dresses this one and we look ok click save now I need to go to intense and I have to click use the hook and click on save now isn't is getting trained after training is complete I will get a message here and I will give it a legend training completed I give a input as Federal Bank interest rate yeah this is the interest rate of Federal Bank is 6.7% it is getting the reply from my server the online server the server of my computer which is linked online and it is faking the interest rate of rate of Federal Bank and it is showing you here you can see the response here see source this is the Egyptian response parameter is Federal Bank intent is bank interest rate and action will be interest okay and it is replaying at success and the responsive going as the interest rate of Federal Bank is 6.7% you can also see in the server running in my computer I have printed in console the all the things you can see it here the request it made and the response is going as this okay so this is your first a I chatbot simplest cat good you can increase it in Google assistant web demo Facebook messengers and many things if I enable web demo you will get a link like this so click here it will open a page like this here you can such as one hon when increase rate okay and you can say that the interest rate of bundle ninety seven point one five percent the percent sign is missing you can code it or if I say only Federal Bank hope the intent is not given I can also use natural language processing I think click here and say that I think allowing my microphone and clear federal bank interest rate federal bank interest rate okay it is working so thank you thank you for watching and this way you can create your simplest ai chat board the source code is available in my github the link is provided below thank you
Info
Channel: Hemanta Nandi
Views: 31,902
Rating: 4.6527777 out of 5
Keywords: chat bot, simple chat bot, making of simple chat bot, how to make chat bot, dialogflow chat bot, python chatbot, chatbot using webhook
Id: FVNyUehBU2I
Channel Id: undefined
Length: 31min 27sec (1887 seconds)
Published: Sun Oct 29 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.