Chatbot using Azure Language Service

In our daily lives, we use many kinds of embedded services within web applications such as chatbots. Embedded chatbots are widely used in web and mobile applications. There are many languages present in the market that support chatbot building, but this article, lets us understand how to build a chatbot using Azure language service. Before actually diving into the overview of Azure language service, let us understand Azure cognitive services.

Overview of Azure Cognitive Services

  • Azure Cognitive services are a bunch of services available in the Microsoft Azure portal which helps the developers and solution architects to build intelligent applications.
  • As we know, To build intelligent applications programmatically, we need to have professional skills in Data Science, Machine Learning, and AI. However, using the services provided by Azure, we can build such applications without direct knowledge of the skills mentioned above.
  • Another significant feature of Azure cognitive services is we can easily provision resources of cognitive services in a matter of minutes and consulate in our project easily and quickly.
  • There are various categories in Azure Cognitive services such as Vision, Speech, Language, and Decision. Moving forward let us discuss more about Language service in Azure Cognitive services.

Azure Cognitive Services: Language Service

  • To understand the significance of Azure Language service let us dive into a generalized example.
  • Imagine you are building an application that receives the user’s input text analyzes the sentiment of the input and generates an accurate response based on the sentiment of the user’s input. This can be done using Azure Language service.
  • Azure Language service helps your app understand the meaning of the unstructured text.

Within the Azure Lnagugae service, we have a few categories where the user input type can fall into:

  • Text analysis: This service can be used to analyze a textual input. The user’s sentiment can be captured based on the textual input they entered.
  • Translator text: This service is used to translate the user’s input text from one language to another language, making your application more suitable for domain-specific or niche scenarios.
  • QnA maker(Knowledge API): This service can be used to create a conversational question-and-answer layer on top of your knowledge base or information. This Knowledge base could be some PDF or Word manuals or even a website.
  • Language Understanding(LUIS): This service can help you to build your next personal assistant. For instance, you can capture a user command such as turn on the lights, pass it to this service and the service can find the intent behind the user command.
  • Immersive Reader: This service is used to help people with dyslexia sort of problems. This service helps the users to make the web content more accessible. The users can adjust the font size, change the colors, translate the text, etc.

These are the main services of Azure language service.

Building QnA Chatbot using Azure Language Service:

let us see the step-by-step approach for building a chatbot using Azure Language service.

Step 1: Create and deploy a Language service instance in Azure cognitive services.

Navigate to the Azure portal and log into your active subscription account.Navigate to the Marketplace and search for cognitive services and under that select Language service.

click on “create language” to create a language service instance.

Now we get the list of features provided by Azure language service and we can add custom features based on our requirements. So, here I am including a custom feature as question answering, to enhance the chatbot activity we can also include another feature that has a more enhanced algorithm.

Add the project details such as subscription details and resource group details. We can use the existing resource group or create a new resource group according to our requirements.

Add the instance details such as name and pricing tier. There are two pricing tiers which are free and standard, each tier description is self-explanatory from the above image.

The Azure language service has also included an in-built Azure search feature. we can also customize the Azure search pricing tier. Also, Make sure you check the AI notice after reviewing the mentioned documents in the portal. Now Review your details and create the instance.

Now, your resource instance will start deploying.

Step 2: Create a project in Azure Language Studio

Navigate to the language instance you have created in your resource group.

Now we can see all the options available to start with the Language service. Navigate to the Language studio.

This is the home page of the Azure Language Studio. Let us sign in to the language studio.

Once you sign in with your credentials. Navigate to the last slide in the carousel. click on “choose resource” to choose your language instance created.

Mention the details such as Azure directory ( your account type ) and your active subscription. Select the resource type as Language.

The resource name field now filters and displays all the existing language service resources available. choose which you have created for this project and click done.

Now we have various language services like Extract information, text classification, etc. We need to understand questions and conversational language services. In that category, choose the custom question-answering section.

Now, we get the interface of Language Studio to play around. click on create a new project.

choose the language in which you want to proceed with the input in your project.

Now enter basic information like the name of the project, description, and default answer when the user inputs are not matched with the predefined inputs.

Review your details. click on create a project.

Step 3: Adding sources and deploying the Knowledge base.

Once your project is loaded. Now click on the Add source and you will find three options to add the data. I.e. URLs of the webpage or files like PDF, XSLV, etc, or chitchat. Let us choose the files option and upload a pre-defined input and output file.

Click on Add file to add it from your computer.

Once you upload your file, it will automatically classify your file structure or there is an option to choose the structure of your file manually. You have a limit of adding up to 10 sources at a time. Add all the sources choose the sources that you want to include in your project and click Add All.

These sources will be your Knowledge base. We also have the option to edit the responses in our knowledge base. Once everything is in the flow. we are ready to deploy our knowledge base.

click on the deploy knowledge base option available in the left side panel.

Step 4: Create and deploy the chatbot.

Once your knowledge base is deployed. Under the next steps, click on Create a bot. Enter the project details and instance details.

Also, enter the app service details like app name and app service plan. Choose the SDK language, it has two options either you can use C# or node.js. If you don’t have an existing app service plan, you can choose to create a new app service plan, or else, you can enter the name of the existing app service plan by choosing that option.

Moving further we need to have the Resource key to access the Language service resources. So we can find the key in the language studio. Navigate back to the Language studio and open the settings.

under the Resources section we can find the Resource key. copy the key.

Now, Under the App setting enter the resource key. All other details are optional and will be auto-filled or you can modify them according to your requirements.

Now review and create the chatbot instance.

Once, the deployment process is completed. Go to your resource group and select the chatbot you have created.

In the left menu, under the setting category, we can see the bot profile which contains the details of the chatbot.

The configuration option contains the endpoints and keys to integrate with any analytical service to manage and monitor our chatbot.

The channels option contains the list of channels we can integrate our chatbot with. Let us choose Microsoft Teams for instance.

Now, at the top, we can see the list of channels through which we can deploy our chatbot app.Let us test our chatbot. This is how the chatbot responds to the user requests.

If you have any webpage where you want to integrate this chatbot app, you can copy and paste the embedded code link and enter the secret keys inside that.

This is how we can build a chatbot using custom question answering of Azure Language service.

Conclusion

This article provided a comprehensive guide on building a QnA chatbot using Azure Language Service. You learned about the various functionalities within Azure Cognitive Services and how Language Service helps applications understand and process textual data.

Chatbot using Azure Language Service – FAQs

What are the benefits of using Azure Language Service for building a chatbot?

  • Pre-built functionalities: Azure Language Service offers pre-built features like custom question answering, eliminating the need for extensive custom coding.
  • Easy knowledge base management: You can easily add, edit, and manage your chatbot’s knowledge base through Azure Language Studio’s user-friendly interface.
  • Scalability: Azure Language Service scales with your needs, allowing you to handle increasing user interactions without performance issues.
  • Integration with various platforms: The chatbots built with Azure Language Service can be integrated with various messaging platforms like Microsoft Teams, providing flexibility for user interaction.

What type of data can be used for the chatbot’s knowledge base?

The knowledge base can include various textual data sources such as:

  • Text files: You can upload pre-defined lists of questions and corresponding answers in text files.
  • Webpage URLs: Azure Language Service can extract relevant information from webpages to populate your knowledge base.
  • Chitchat: The service offers pre-built “chitchat” functionality for casual conversation starters and responses.



Contact Us