Best situations when to use BotFramework Dispatch - botframework

I've been reading the article on setting up BotFramework Dispatch middleware and there are a few things I don't understand. The article is https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-dispatch?view=azure-bot-service-4.0&tabs=cs
Article mentioned to use dispatch when we use multiple LUIS and/or QnA Models. But it seems that as soon as we have 1 of each (LUIS and QnA model) we already need a dispatch. Is there a way to avoid using dispatch if I have just one of each?
How does dispatch LUIS get maintained when changes occur in underlying LUIS or QnA models?

The idea of Dispatch tool (which is based on LUIS in fact) is being able to dispatch intent between several systems. As soon as you have more than 1 system which can understand intents (whether it is LUIS, QnA Maker or 3rd parties), how would you know which one will be the best for your case?
In a few words, dispatch will group intents for each system into global intents, and so when you call it you will know which systems is the best matching one, then you route your sentence to this best matching system to get the right granularity.
And as you mentioned, to maintain it, there's no secret: it must be updated when you update your underlying LUIS intents/utterances or QnA Maker KB systems

Related

Are LUIS model features lost in Dispatch model created with botframework cli tool?

In the last days I spent few time in fine tuning a LUIS model of a Botframework Skill. I found really useful to use "Phrase list" feature to define synonyms and obtain a better behavior from the skill bot.
Unfortunately when I connect the Skill to the Bot, I notice that the "Phrase list" features are no more present in the dispatch model created by the cli tools.
Is this a known behavior/limitation or am I doing something wrong?
Dispatch CLI combined phraselists into new ones to make sure the new Dispatch phrase lists are under the quota. Could you check if specific words you are looking for are under the phraselists created by Dispatch?

How to use Dispatch for multiple Luis model with different cultures

I am working on a bot which will have multiple languages(English, French and Spanish). So that I have created multiple Luis models with different cultures i.e en-us, fr-fr and es-es. Now how to add Dispatch for this? I am able to create dispatch for the same culture not for multiple cultures.
Please help me with this. Thanks in advance...!
Reference: https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-tutorial-dispatch?view=azure-bot-service-4.0&tabs=csharp
Dispatch feature provided for LUIS is language dependant as you mentioned (because LUIS is language dependant).
The best way to handle this case is to detect the language on your bot side (not on LUIS side) and then call the right LUIS model given the detected language.
This can be done by using Detect language from Text Analytics API in Microsoft Cognitive Services: https://westus.dev.cognitive.microsoft.com/docs/services/TextAnalytics.V2.0/operations/56f30ceeeda5650db055a3c7

In LUIS, is that possible to generate intent, utterance and proposed answering automatically?

I am very new to Microsoft LUIS, and thinking the feasibility to utilize LUIS to build the Q&A ChatBot to provide the IT technical support to our users.
We have the 2-years support log in one email, my original idea is, to extract this support log to train/test LUIS, if the test result could be accepted, we may enable chatbot in SKYPE to provide the support to our users.
After I go through the following document or course:
https://learn.microsoft.com/en-us/azure/cognitive-services/luis/
https://courses.edx.org/courses/course-v1:Microsoft+DEV328x+2T2018/course/
My understanding is, to build technical support chatbot, I have to:
1) Manually create the entities / intents / utterances in LUIS, then train / test LUIS, or achieve this by programming via LUIS API (it may like what is mentioned in the following thread:Approaches to improve Microsoft ChatBot with each user conversation by learning from it?). The purpose of this step is , when users raise the questions, chatbot could match users' questions to the defined intents.
2) Customize the reactions based on the intents. And based on the intents identified in the above, answer the questions to users or redirect the questions to human if questions could not be found out.
My question is whether it is possible for LUIS to be trained by those 2 years' support log (fed in some formats such as in JSON), then automatically generate the intent / entities / utterance as well as answering for our test?
Your kind input or advises would be highly appreciated.
Best regards
Patrick
My question is whether it is possible for LUIS to be trained by those
2 years' support log (fed in some formats such as in JSON), then
automatically generate the intent / entities / utterance as well as
answering for our test?
Yes, by using Batch Testing you can upload no more than 1000 utterances to test which will serve the purpose. In this case you have to create the intents and entities.
My question is whether it is possible for LUIS to be trained by those
2 years' support log (fed in some formats such as in JSON), then
automatically generate the intent / entities / utterance as well as
answering for our test?
Yes, LUIS provides a programmatic API that does everything that the LUIS website does. This can save time when you have pre-existing data and it would be faster to create a LUIS app programmatically than by entering information by hand.

How can the performance of LUIS models be improved?

If you have used the Language Understanding Service (LUIS) which is part of Cognitive Services suite from Microsoft, you probably have come to the point where you needed to improve the performance of your models at predicting intents.
LUIS allows you to train models based on sample utterances which you supply either interactively or in batches. In addition, I would like to have the chat logs showing utterances which are wrongly classified by the model so I can use them as a basis for new training data-sets.
I would imagine that such feature would be released in future but in the meantime, does anyone have a work-around for this scenario?
I think a good way to implement this (by hand), would be to route all the messages that were wrongly classified to some kind of storage or log so you could in the future use them to retrain your LUIS model. In fact, you could use LUIS API to make calls dynamically and easily with the data in your log.
So, the flow would be something like this:
1) User send message to bot.
2) Bot logic tries to match message's intent using LUIS model.
3) An intent isn't found or the value associated to the result is really low.
4) Grab that message and store it somewhere (from a simple txt file stored in an Azure Blob Storage), or in in a Database (Table Storage, DocumentDB or SQL Server).
5) Make a simple program that for each line in your log makes you choose an intent and then it calls LUIS Api to retrain.
So, I found the closest thing to what I had in mind when I asked the question.
Right on the "MyApps" page on luis.ai there's the possibility to download the chat logs in which one can see the entire set of interactions between users and the bot. It could be a good starting point for picking out intents which were wrongly classified.
I attached a screenshot to indicate the link
The only caveat is that the log chat format is currently in .csv which isn't so readable. Hopefully LUIS supports json formatted logs soon.

Creating an API for LUIS.AI or using .JSON files in order to train the bot for non-technical users

I have a bot that uses .NET, MS Bot Framework and LUIS.ai for its smarts.
All's fine, except that I need to provide a way for non-technical users to train the bot and teach it new things, i.e. new intents in LUIS.ai.
In other words, suppose that right now the bot can answer messages like "hey bot where can i get coffee" and "where can I buy some clothes" with simple phrases containing directions. Non-technical users need to be able to train it to answer "where can I get some food" too.
Here's what I have considered:
Continuing to use LUIS.ai. Doesn't work because LUIS.ai doesn't have an API. The best it has is the GUI to refine existing intents, and the upload app/phrase list feature. The process can be semi-automated if the JSON file with the app can be generated by some application that I write; however, there still needs to be backend code that handles the new intents, and that has to be implemented by a C# coder.
Could it work if I switch from C# to Node.js? Then theoretically I would be able to auto-generate code files / intent handlers.
Azure Bot Service. Seems it doesn't have a non-technical interface and is just a browser-based IDE.
Ditching Bot Framework entirely and using third-party tools such as motion.ai. Doesn't work because there's no "intellect" as the one provided by LUIS.ai.
Using Form Flow that's part of Bot Framework. If my GUI bot builder application can generate JSON files, these files can be used by Bot Framework to build a bot automatically. Doesn't work because there's no intellect as in LUIS.ai.
Keep using Bot Framework, but ditch LUIS and build a separate web service based on a node.js language processing library for determining intents. May or may not work, may be less smart than LUIS, and could be an overkill.
Override the method in LuisDialog that selects the intent from the LuisResponse, in order to use the my own way to decide the intent (but how?).
At this point I'm out of ideas and any pointers will be greatly appreciated.
First of all, LUIS.ai provides an API that you can use to automatize the training. Moreover, here is Luis Trainer written entirely in Python against the API that just does that.
The easiest one, probably is the one you are describing in #1: you can automatize the training (as explaining above) but you will still have to deploy a new version of the bot if new intents are being provided. One thing is letting users to train an existing model with new utteraces and another completely and different thing is to let them create the model :)
It might be hard to skip having to write the backend code (I wouldn't automatize that at all)
Here is a potential idea (not sure if it will work though). You would need 2 Luis models.
One with your current model, that users will be able to train with new utterances.
The second model, is one exclusively intended to be "expanded" with new intents by users.
If you separate this in that way, you might be able to look into a "plugin" architecture for the second LUIS model. So, your app, somehow, loads dinamically an assembly where the second model lives.
Once you you have that in place, you can focus on writing the backend code for your second Luis Model without having to worry about the bot/first model. You should be able to replace the assembly with the second Luis Model and be able in the bot to detect if there is new version of that assembly and replace the current one in the app domain.
As I said, is just an idea as I'm brainstorming with you. Sounds a bit complex, and it's not addressing all your concerns; as you still will need to write code (which in any case, you will eventually have to do)
I am working through a challenge project (training) to automate the creation of Chat Bots specifically targeted against a Luis.ai model using plain old javascript and web services to Luis.
I looked at the Bot Framework and it's just too cumbersome to automate (I want X number of customers to create a Chat Bot without coding). I also want to add my own type of 'Cards' (html widgets) that do more and can be easily configured by someone with zero coding skills.
Calls to the Luis.ai/Cognitive Services API are made in my code behind and the json response returned to my own rules engine. On the following URL click the LUIS API link on the page to open the Luis API Console where you can test, and train your Model. All the endpoints you will need are here...
https://dev.projectoxford.ai/docs/services/
Based on the various endpoints on that page, you can use WebClient in asp.net to pull back the response. So in my testing I have buttons on a page to push utterances up to the model, pull back entities, create hierarchical entities and so on. Have a look at http://onlinebotbuilder.com to see how an intent of product dynamically inserted a shopping cart.
When your tool is built and utterances start to arrive, Luis.ai will store them and via the Suggest tab (at Luis.ai) it will ask you for guidance...Unfortunately I don't think you could give that control over to your customers, unless they are experts in your domain (they understand which utterance belongs to which intent). You don't need to take your app down, just train it periodically to improve the Model based on your customers input...soon enough you will have your model working well based on your intents.
Hope that helps.

Resources