paint-brush
Automating Multilingual Customer Service with Power Virtual Agent and Azure Cognitive Servicesby@thecognitiveservicesninja
324 reads
324 reads

Automating Multilingual Customer Service with Power Virtual Agent and Azure Cognitive Services

by Holger ImberyApril 24th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Microsoft Power Virtual Agents are perfect for automating customer service. When combined with Azure Cognitive Services, they are almost infinitely extensible. A simple Power Automate flow helps your Power Virtual Agent serve your customers in over ninety languages. We created a new project on [Azure Language Studio] to integrate a FAQ Database on “growing chilies”
featured image - Automating Multilingual Customer Service with Power Virtual Agent and Azure Cognitive Services
Holger Imbery HackerNoon profile picture


A step-by-step Kickstarter to Power Virtual Agent and Azure Cognitive Service for Language


Power Virtual Agent (PVA) is getting better and better from Release to Release, but there are situations where you want to use Azure Services to improve your user’s experience.


Why not combine Azure Cognitive Services for Language with PVA to add missing elements?


  • Imagine serving your customers and employees immediately in their native language without extra effort and without investing time in translating and maintaining your QnA in other languages.
  • Imagine there is no need for additional resources, but your customers and employees will feel more directly addressed.
  • Imagine your employees can refocus on delivering value to your customers instead of being a voice interface of a QnA collection. Microsoft Power Virtual Agents are perfect for automating customer service, and when combined with Azure Cognitive Services, they are almost infinitely extensible.
  • How easy is that? A simple Power Automate flow helps your Power Virtual Agent serve your customers in over ninety languages.


PVA has a built-in topic that can serve as a hook to the outside world, the “Fallback” system topic.


Activate the “Fallback” topic

Activate the “Fallback” topic



To activate the “Fallback” system topic, go to Settings within the editing canvas (click on the cog symbol), then System fallback, and then “+Add”.


After activating the topic, you will find it within “topics”.

activated fallback topi



The “Fallback” topic is ready to connect with the outside world, as everything not recognized by our already in-place topics will end up here as “unrecognized user input”.

/Extend Power Virtual Agent to a multilingual QnA Resolver


If you have no PVA bot handy, try my “Power Virtual Agent in a Day” Example as a starter.



This example will integrate a FAQ Database on “growing chilies”. Data from a random web page, “Greenhouse Garden Shop — Growing Chillies FAQ will be used.



I´m not related to this shop but let´s respect their knowledge of growing chilies and use their questions and answers here!!

Following my slogan:

“Sriracha on everything!”

Chilies are the main ingredient of Sriracha. :)


Custom question answering

We created a new project on Azure Language Studio  and chose “Custom Question Answering”.


Create a new Custom Question Answering Project


  • Choose the option “I want to set the language for all projects created in this resource” > select English > Select Next.

  • Enter a project name, “PVAinaDay-CQA”, a description, and leave the default answer with a setting of “No answer found”.

  • Review your choices and select Create project

  • From the Manage sources page, select Add source > URLs.


Select Add URL, enter the following values, and then select Add all:

  • URL Name

  • URL

  • Growing Chillies


https://www.greenhousesensation.co.uk/growing-chillies-faq/


Add URL of FAQs



Language Studio will now import your FAQs into the project and gives you single and multiturn Question and Answer pairs.


Question and Answer pairs in Knowledge Base



To use the imported content, we need to clean up the answers and make them usable for a bot. We must remove pictures and links if our bot is a voice bot.


Add alternate phrases



To make the Answering more fluent, we will add variations to each question.

And deploy the knowledge base.


Select “Deploy” on the left side and press “deploy” on top to deploy



After deploying the knowledge base, we press “Get prediction URL”, and we note down the Site URL(Red) and the Account Key (Yellow); we will use both later in Power Automate.


Retrieve the Site URL and Account Key



Integrate Custom Question Answering and Microsoft Translator into Power Virtual Agent via Power Automate

We jump back into your newly created “Fallback” Topic and remove the “Escalate” and the “Message” node.


After deleting the nodes, we create a new “Call an action” node.

Create a new Call for an action node



Power Automate will open, and we can create a new flow.

First, we rename the flow and define the input.

Define Input



To determine the language of the question, we will initialize a new variable, “QuestionLanguage”. We will use it to store the language code.

Initialize variable



Create a new node by searching “Microsoft Translator V2” and selecting “Detect language”, and set Text to the content of the variable “UnrecognisedUserInput”.

Create Detect Language Node



We use a set Variable Node to store the output of “detect language” into the “QuestionLanguage” Variable

Initialize Variable QuestionLanguage



with a translate text node (Microsoft Translator V2); we translate the content of “UnrecognizedUserInput” to English.

Translate to English



Create a new node by searching “Language — Question Answering” and selecting “Generate answer from Project”.

Create Node



We noted the account Key and Site URL earlier in this guide; we use the values now.

Set “Question” to the output of the translation node.

Generate Answers from Project



Next, Initialize a new variable with a name, e.g., “CQA_Answer”

Initialize Variable CQA_Answer



A “Apply to each” Node with a “Translation” and a “set Variable” action will translate back to the language the question was asked in.

Apply to each Node with two actions



Finally, we adjust the Return Value to the content of the “CQA_Answer” Variable.

Return Value with Content of CQA_Answer Variable



After saving the flow, we can select the flow in the action node, adjust the input, and create a message node to display the output of the flow.

Complete Topic with Power Automate Flow



The flow will result in the following:

A question asked to the bot without a topic in PVA will end up in the “Fallback” topic. Custom Question Answering will help with the answer, even to a question not asked in English.


Result: multilingual QNA



Additional Information

  • Custom Question Answering — documentation [successor of QnA Maker]
  • Conversational Language Understanding — if you would like to make the next step — documentation [successor of LUIS]
  • Power Automate Connectors — documentation



Featured image by Sebastian Bill on Unsplash.

Also published here.