{"id":82,"date":"2018-06-11T16:20:06","date_gmt":"2018-06-11T14:20:06","guid":{"rendered":"https:\/\/billigeplaetze.com\/?p=82"},"modified":"2024-08-14T13:52:43","modified_gmt":"2024-08-14T11:52:43","slug":"ai-as-a-service","status":"publish","type":"post","link":"https:\/\/craftcoders.app\/ai-as-a-service\/","title":{"rendered":"AI as a Service – a Field Report"},"content":{"rendered":"
In this blog post I describe my experiences with AI services from Microsoft and how we (team Billige Pl\u00e4tze) were able to create hackathon award winning prototypes in roughly 24 hours with them. The post is structured according to the hackathons we participated and used AI services in, as of now (11.06.2018) there are 2 hackathons where we used AI services, but im sure there are a lot more to come in the future. The first one was the BlackForest Hackathon<\/a> which took place in autumn 2017 in Offenburg and the second one was the Zeiss hackathon<\/a> in Munich, which took place in January 2018. Artificial Intelligence as a Service (AIaaS) is third-party offering of artificial intelligence, accessible via a API. So, people get to take advantage of AI without spending too much money, or if you’re lucky and a student, no money at all.<\/p>\n As already mentioned above, we have used several Microsoft services to build our prototypes, including several Microsoft Cognitive Services and the Azure bot service. All of them are part of the Microsoft AI platform<\/a>, where you can find services, infrastructure and tools for Machine Learning and Artificial Intelligence you can use for your personal or business projects.<\/p>\n we used only some of the services of the AI platform<\/p><\/div>\n The BlackForest Hackathon has been the first hackathon ever for our team and we have been quite excited to participate.<\/p>\n The theme proposed by the organizers of the hackathon was “your personal digital assistant”, and after some time brainstorming we came up with the idea of creating an intelligent bot, which assists you with creating your learning schedule. Most of us are serious procrastinators (including me :P), so we thought that such a bot can help us stick to our learning schedule and motivate us along the way to the exam. With the topic of the hackathon in mind we wanted the bot to gather the user input via a dialog as natural as possible.<\/p>\n Billige Pl\u00e4tze in Action<\/p><\/div>\n Cem and I have experimented a little bit with the Azure Bot Service before the hackathon, and we thought it to be a perfect match for the task of writing the bot. We also wanted the bot to process natural language and stumbled upon LUIS, a machine learning based service for natural language processing, which can be integrated seamlessly into the bot framework (because it is from Microsoft, too). The combination of C#, the bot service and LUIS provided the core functionality of our bot and we were able to deploy it to Azure within one click.<\/p>\n The Bot Service provides an integrated environment that is purpose-built for bot development, enabling you to build, connect, test, deploy, and manage intelligent bots, all from one place. Bot Service leverages the Bot Builder SDK with support for .NET and Node.js.<\/p><\/blockquote>\n Overview of the Bot Service<\/p><\/div>\n The bot service consists of the concepts of<\/p>\n Dialogs, another core concept, help organize the logic in your bot and manage conversation flow. Dialogs are arranged in a stack, and the top dialog in the stack processes all incoming messages until it is closed or a different dialog is invoked.<\/p>\n General Conversation flow of the Bot Service<\/p><\/div>\n By using the bot service we were able to focus on programming the actual conversation with the Bot Builder SDK. To use the bot service you just have to create a new bot in Azure<\/a>, and connect to the channels of your choice (Telegram worked like a charm) also via the web app. LUIS is a machine learning-based service to build natural language into apps, bots, and IoT devices. the LUIS web application<\/p><\/div>\n LUIS is tightly integrated in the bot service, to integrate our model all we had to do was to add an annotation to a class and extend the prefabricated LuisDialog to get access to our intents and entities.<\/p>\n Theres nothing else to do to integrate LUIS into your bot. The bot connector service handles the message exchange between your bot code and the LUIS REST API and converts the JSON into C# objects you can directly use. Fun fact: the integration of the google calendar into our bot took us several hours, a lot of nerves and around 300 lines of code, whereas the integration of our LUIS model took around 5 minutes and the lines of code for every LuisDialog we created.<\/p>\n By using the Azure bot service in combination with a custom LUIS model we were able to create a functional prototype of a conversational bot assisting you in creating your custom learning schedule by adding appointments to your Google calendar in roughly 24 hours, all while being able to understand and process natural language. With the power of the bot service, the bot is available on a number of channels, including Telegram, Slack, Facebook Messenger and Cortana.<\/p>\n It was a real pleasure to use these technologies because they work seamlessly together. Being able to use ready-to-use dialogs for LUIS sped up the development process enormously, as well as being able to deploy the bot on azure within one click out of Visual Studio. I included a little demonstration video of the bot below, because it is no longer in operation.<\/p>\n
\nThis post is not intended to be a guide on integrating said services (Microsoft has nice documentations of all their products \ud83d\ude42 ), but rather a field report on how these services can be used to actualize cool use cases.<\/p>\nThe Microsoft AI Platform<\/h2>\n
BlackForest Hackathon<\/h2>\n
<\/p>\n
\nThe features we wanted to implement for our prototype are<\/p>\n\n
The technology stack<\/h3>\n
\nOur stack consisted of, as expected, mainly Microsoft technologies. We used<\/p>\n\n
The Azure Bot Service<\/h3>\n
\n
<\/p>\n
\nAfter creating your bot in Azure you can start coding right away by using a template provided by Visual Studio, you just have to type in your bot credentials in the configuration file and your good to go. Because we didn’t have to worry about where to host the bot and how to set it up we were able to quickly create a series of dialogs (which involved serious copy pasting :P) and test our conversation flow right away by using the botframework emulator<\/a>, and when we were happy with the results publish the bot on Azure within one click in Visual Studio.
\nWe didn’t have to worry about getting the user input from the messaging platform and integrating natural language understanding into our bot was very easy, because we used Microsoft LUIS. We were seriously impressed by the simplicity of the bot service.<\/p>\nMicrosoft LUIS<\/h3>\n
\nYou can create your own LUIS app on the LUIS website<\/a>. A LUIS app is basically a language model designed by you, specific for your domain. Your model is composed of utterances<\/em>, intents<\/em> and entities<\/em>, whereas utterances are example phrases users could type into your bot, intents are the users intention you want to extract from the utterance and entities represent relevant information of the utterance, much like variables in a programming language.
\nAn example for an utterance from our bot could be “I write my exam on the 23rd of August 2018”. Based on the utterance, our model is able to extract the intent “ExamDateCreation” as well as the entity “Date” <– 23.08.2018 (for a more detailed explanation, visit the LUIS Documentation<\/a>). Once you define all your intents and entities needed for your domain in the LUIS web application and provide enough sample utterances, you can test and publish your LUIS app. After publishing you can access your app via a REST API, or in our case through the Azure bot service.<\/p>\n[Serializable]\r\n[LuisModel(\"your-application-id\", \"your-api-key\")]\r\npublic class ExamSubjectLuisDialog : LuisDialog<object>\r\n{\r\n [LuisIntent(\"Klausurfach\")]\r\n private async Task ExamPowerInput(IDialogContext context, IAwaitable<object> result,\r\n Microsoft.Bot.Builder.Luis.Models.LuisResult luisResult)\r\n {\r\n ...\r\n }\r\n}\r\n<\/code><\/pre>\n
Summary<\/h3>\n