AI applied to MSDyn365FO thanks to LUIS and Flow (1/2)

Posted by
Version Française disponible ici

Have you ever heard of Microsoft investigating massively in AI ? Probably yes, if you are reading this post, that means you have some interests in what Microsoft do with the ERP and AI. Here we will focus on Language Understanding Intelligence Service (LUIS), which is « A machine learning-based service to build natural language into apps, bots, and IoT devices ».

Basically, LUIS is able to analyse a voice, a mail content… and to find which intent it is according to your setup and the training.

If we are writing a blog post it’s because we have connected LUIS to Microsoft Dynamics 365 for Finance and Operations to implement one process. You could have a lot of use cases like :

  • Amy don’t have access to the ERP and wants to order a new laptop. She send an email to James, which is in charge of creating purchase requisitions. LUIS analyse the mail content and creates a purchase requisistion with the account of James for Amy.
  • Paul is a customer of the Contoso company. He send an email to John, which is a sales data entry operator, with the content of his current order. The sales orders is automatically created in the system.

So let’s discover LUIS at first with the key concepts.

Apps

First, you need an apps, which is basically your project you’re working on.

Intents

You need now to initialize your intent. It’s very important and structuring. By analysing the content LUIS will find (or not) what is the intent of your request. I have only one here, which is « Create a SO ». I could have « Create a SQ » but I wanted to start with a simple test.

As you can see, you also need a None one.

Search for data : Utterance and Pattern

Now you will need to search for data. There is 2 possibilities to achieve that : through utterances or patterns.

Utterance : it’s an example of an intent. It very easy to setup it. It works fine with partial mapping, but it’s not very powerful compare to Patterns.

Pattern : look like Utterance but it’s more strict (you cannot get a result with a partial match). On the other side, it’s much more powerful, we’ll see that later on.

Structure that we are looking for in the text : Entity

Have you noticed the highlighting colors in patterns and utterance ? Well, that’s entities, the concept you are looking for in the text.

You have different types of entities :

  • Simple: based on utterance ; I don’t use them in the demo.
  • List: it a predefined list of values. As you can see, you can setup Synonyms and the system recommends you some suggestions (yes AI it is).

  • Regex: you can here setup some regular expression. If you are familiar with them, it could be powerful.
  • Prebuilt: there is a set of prebuilt entities (Currency, Date, Number…) that you can use. In each of them, you can setup a role which will give you some details (useful for patterns).
  • Composite: used if you want to setup some hierarchy between entities.
  • Pattern: if you are looking for an undefined part. It’s not precise and you can isolate some large part of the content.

Tests and trains

Now the tests. I’m going to test with the following sentence. « bonjour monsieur, il me faudrait 5 ordinateurs de type C0004 à livrer pour le 18/08/2018 ».

As you can see, the correct intent has been found at 84% but no pattern has been matched.

You see which entities the system try to allocate values. Here is the limitation of utterances, as the number entity is used of 18 and 5 and « 08/2018 » which is a little bit curious. Anyway, you cannot use that if you want to get further.

Let’s try another test. If I input this I’ve got :

So here the scoring intent is not high enough to be sure of the intent. What you can do is make LUIS smarter by clicking on edit and make him learn.

Don’t forget to Train your apps. After that, the result is much better (96%), and a new utterance has been created.

Let’s try one last test here.

As you can see, the intent scoring is up to 100%, and a pattern has been matched (meaning I’ve send to LUIS the exact sentence that I’ve setup as a pattern). In the number and datetimeV2 entities,  you can see the role allocated. Here LUIS is able to isolate and give a role to the correct number and date. This is much more interessing for further treatments.

Limitations

The only frustration at that stage is that you cannot train LUIS to match patterns as you can do to when routing LUIS to a specific intent when he’s lost. If you have a missing accent in your sample LUIS won’t match the pattern and you cannot easiely make him learn. There is some other limitations but mostly with this 1 year old tool it’s already getting results. That’s great and you don’t need to be a technical guy or a geek to achieve to make LUIS work. Stay tunned for the full example describes in the next post.

End of the post here

Yohann ROLLAND & Guillaume FAGES

8 comments

  1. Hi,

    Thanks for this great example. Do you know what could be the reason that I dot not have the option « Prebuild » woth Entity Type? Thanks

Leave a Reply

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.