Cross Train feature issue and work around in Bot Framework Composer

Chatbot Development in Bot Framework Composer | Troubleshooting Bot Framework Composer Bot | Using Cross train feature effectively in Bot Composer

Sanjeevi Subramani's photo
Sanjeevi Subramani

Published on Nov 18, 2021

2 min read

Subscribe to my newsletter and never miss my upcoming articles

In this article we will go through the issue faced in using the Cross-train feature in the new Bot Framework Composer and how to overcome it and use it efficiently.

This is an explanation for the following GitHub issue:

Bot Framework composer comes with cross train feature which helps better context-based switching between QnAMaker and LUIS intents in user chat flow.

Cross train command creates utterances for the QnAMaker questions in the LUIS under the QnAMaker Intent, so that in middle of chat if the user asks a question from the QnAMaker then the bot will detect the QnAMaker Intent and redirect the user to QnAMaker answer for the question asked based on score.

Similarly Cross Train creates an entry for the list of intents and utterances we have in the bot LUIS into the QnAMaker as a qna pair with answer something like this syntax - "intent=DeferToRe...", this will help the bot to redirect to LUIS intents in middle of any QnAMaker flow if the user is in middle asks for a task of LUIS intent.

Now we know the use of Cross Train and how it works, let's go to the problem now.

Because of the newly added QnA pair for the LUIS intents in the QnAMaker, it also creates an issue when you add a qnamaker flow/qnamaker question answer http request manually without using the default QnAIntent recognizer intent flow, this may be needed in many situations based on business requirements. Whenever the bot is in middle of QnAMaker flow if a user asks for an intent present LUIS flow then the bot returns the "intent=DeferToRe..." answer created in above Cross-Train flow.

To avoid this, we can follow this approach below of filtering the source metadata to not get the answers from cross-train source.

So that i can use both the cross-train feature and qnamaker querying flow smoothly. Now i have the qnaIntentRecognizer as an intent for cross train featured answers switching between qna and Luis effectively and custom qnamaker call without cross train data in answer.

Made the qnamaker call as an http request with the following query - so that avoiding the 'crosstrain' source to come in the answer.


{
    "question":"how",
    "strictFilters": [
         { "name": "source_name_metadata","value": "Custom Editorial"},
         { "name": "source_name_metadata","value": "chitchat"}
    ],
    "strictFiltersCompoundOperationType": "OR"
}

In the query filter above i am filtering all the source metadata i have in my QnAMaker knowledgebase except the cross-train source metadata which will be created by the Cross-Train feature as explained.

Thanks, Happy Coding :)

 
Share this