Smart Email intake.
Step 3 - Create instant flow to translate
Smart Email intake.
Step 3 - Create instant flow to translate sample data into target language
As we want to support three languages, English, French and German to analyze the Email content, we need to have sample data for each supported language. AI Builder has a Text translation prebuilt model and we can use it to translate the Case Description into a selected target language.
Column | Description |
---|---|
Description | Holds the plan text email content. |
Description Translated | Holds the translated to target language “Description” to be used in the AI Builder Category Classification model. |
Category Tags |
Holds the analyzed category tags of the Description text. In a first iteration you will add the Category Tags manually. After you’ve trained models, we’ll include the trained model into the “Automatically create Case records from Email” flow to analyze the Email content and get the Category Tags based on the trained model. |
Category Tags Translated | Holds the Category Tags to be used in the AI Builder Category Classification model. |
Consider how to deal with single or multi-language model support
- For a multi-language scenario, I recommend to keep the Category Tags in one common language, as we will use the Category Tags later to route the Case using Routing Rules to the skilled Agent. In our case we used English as the common language for tagging the categories.
- For a single-language scenario, I recommend to translate everything into one common language like English. And just use one common language model to analyze and route the cases.
Prerequisites
Make sure that the following prerequisites are met:
- Permissions, roles, and the Power Automate license to create automatic record creation rules.
- Case entity prepared as described in Create a solution “Case Management” before.
Create Translate Cases to Target Language instant flow
The helper flow should be triggered manually passing a target language code value to translate the Description into the target language and persist it into Description Translated for later used to train the AI Builder model for different language. The building blocks are:
- Define the used variables
- Check user input
- Get list of cases
- Translate content to target language
Now let’s create the helper flow
- Sign in to Power Apps (https://make.powerapps.com/) and then select Flows > Cloud flows.
- Select “New flow” and select “Instant cloud flow”
- Add the following additional variables steps
- Add a Flow Scope step and name it “Check user input”
- Add a Condition step to check if user input is a valid supported target language code.
- Add in “If yes” a new Flow step Set variable and name it “Set variable Target Language to User Input”. Set Name equal target_language and Value equal User Input target_language.
- Add a Flow Scope step and name it “Get list of cases”
- Add a Dataverse List rows action and name it “List cases”
- Select Table name “Cases”
- Add Fetch Xml Query to get only active cases with category tags. See below sample
- Add a Flow Scope step and name it “Translate content to target language”
- Add a AI Builder Step “Detect the language being used in text” and name it “Detect the language being used in case description”
- Add a Flow Step “Set variable” and name it “Set variable AI Builder Language”. Choose the “ai_builder_language” variable for Name and for Value “Language” result from the AI Builder.
- Add a Condition step to evaluate the detected language confidence score is a valid result between 0 and 1.
- Add in “If yes” a new Flow step Set variable and name it “Set variable AI Builder Language Confidence Score”
- For Name choose the variable “ai_builder_language_confidence_score” and for Value add the AI Builder Confidence Score result.
- Add in “If no” a new Flow step Set variable and name it “Set variable AI Builder Language Confidence Score”
- For Name choose the variable “ai_builder_language_confidence_score” and for Value add 0.
- Add a Condition step to evaluate the detected language is a valid result en, fr, de
- Add in “If yes” a new Flow step switch to evaluate the supported target language model. Set On equal to target_language variable
- Add a Switch cases for English language and name it “Language equal english”
- Set Equals to en
- Add a AI Builder Step “Translate text into another language” and name it “Translate description to english”.
- Set Text to Case Description and Translate to English
- Add a Flow Step “Set variable” and name it “Set variable Translated Description for english”. Choose the “translated_description” variable for Name and for Value “Translated text” result from the AI Builder.
- Add a AI Builder Step “Translate text into another language” and name it “Translate category tag to english”.
- Set Text to Case Category Tags and Translate to English
- Add a Flow Step “Set variable” and name it “Set variable Translated Category Tag for english”. Choose the “translated_category_tag” variable for Name and for Value “Translated text” result from the AI Builder. See result
- To support other languages too, repeat the steps 21 to 28 for French and German.
- Close the switch action
- Add a Dataverse Step “Update a row” and name it “Update current case”
- Set Table name equal “Cases”, Row ID equal “Case”, Category Tags Translated to translated_category_tag variable and Description Translated to translated_description.
- Select “Save” to persist all changes you made to the flow.
- Select “Test” to test your flow with User Input with a supported language code.
Step | Initialize variable Target Language | Initialize variable Translated Description | Initialize variable Translated Category Tag | Initialize variable AI Builder Language | Initialize variable AI Builder Language Confidence Score | Initialize variable Case Description Translated |
---|---|---|---|---|---|---|
Name | target _language | translated _description | translated _category_tag | ai_builder _language | ai_builder _language _confidence _score | case _description _translated |
Type | String | String | String | String | Float | String |
Value | en | none | none | en | 0 | none |
See results
Now we’ve helper flow to simple translate the Case description into any target language. We will use this helper flow to prepare the sample data for the AI Builder models for category classifications.
Steps by step guide
- Create a solution “Case Management”
- Create a Automatically create Case records from Email ruleset
- Create instant flow “TranslateCasesToTargetLanguage”
- AI Builder category classification custom model
- Extend Automatically create Case flow with AI Builder models
- Configure Unified Routing based on Category Tags to Agents
5. Jan 2023