How To Flashing itel 1406

keyword : How To Flashing itel 1406 for bootloop , How To Flashing itel 1406 for softbrick , How To Flashing itel 1406 for hardbrick , How To Flashing itel 1406 Error Camera , How To Flashing itel 1406 blank screen , How To Flashing itel 1406 lost password , How To Flashing itel 1406 stuck logo , How To Flashing itel 1406 new 2017. How To Flashing itel 1406 repair phone.
Download one of the above file:
How To Flashing itel 1406
in this tutorial we are going to see howwe can use wit.ai natural language processing capabilities in elixir forcreating bots. after signing up for wit.ai and creating an application createa story. stories are simply the conversations you think you users willhave with your bot. the user will ask the bot about theweather of a particular location we extract the location information andstore it in the context then the bot should execute fetch weather action toget the temperature. once we get the temperature the botwill reply back the user with the temperature of that location and at theend we execute the story ended action.
we will use the echo phoenix microsoftbot project as the bootstrap project. clone project get its dependencies andthen compile. now open the mix.exs file to add newdependencies. add elixir wit dependency to call the wit apis also add httpotion and poison. we will use them to make requests to theweather apis edit messages_controller.ex, remove allthe functions in it except the message received function. first create the get wit access token function in which weretrieve the wit access token from our config as this is required to authorizecalls to wit api. in message received
function we will call wit apis is in anew process. in that process we create a context which has information about themessage that we will need later on to reply back to the user. then we will callwit.run_actions from elixir_wit library. we passin the access token, session id, the module that implements the actions, message received from the user,context and the maximum number of times the api will be called. we will returnback 200 response from the message received function. now create a new module weatherconversation action. in this module we have to define the default actionsrequired by the library and the custom
actions that were in your story. first define the say function which takes the session id, context and the response fromwit as parameters. this function is called when wit wants thebot to reply back to the user. here we get the relevant values from thecontext that we added in message controller and then we will call themicrosoft bot framework client to send message to the user. we create the get bot auth datafunction to get the app id and app secret which is required for authorizing therequest to microsoft bot apis. then we add the second action which is themerge action.
this is called when wit has extractedinformation from the text and wants you to merge it into context. here we get thelocation information add it to the context and return the updated contextfrom the function. the last required function is the error function which iscalled when there is an error in running actions you can define custom actionusing defaction macro. we will use this to define thefetch weather action. in this function we get the location from context that wepreviously added and then call the weather api. we convert the weather tofahrenheit and return back the updated context.
lastly we define the story ended customaction and just log it. now we define the weather client module in which we createthe get weather function which calls the open weather map apis to retrieveweather information. the last thing is to add wit accesstoken and open weather map app id in our config. as we are going todeploy to heroku so we get those values from the environment variables that weset using heroku dashboard. let's just compile and deploy to heroku. here is the end result. when we asked ourbot about the weather in london it extracts the location information andreplies back with the weather.
even if we asked about weather inslightly differently way wit is smart enough to know that the user intent is to askabout weather. thank you for watching this screencast!
No comments :
Post a Comment