botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Use LUIS in scorable

Open dchathu opened this issue 9 years ago • 7 comments

Issue Description

I've read that to handle messages globally, I have to use Scorables and set a score based on the user's input. I am wondering if I can use LUIS to parse the user input and set a score based on LUIS intent score.

Is there any way that I can use LUIS inside my Scorable class?

Or do i have to manually call LUIS and get the response and process myself?

dchathu avatar Oct 04 '17 05:10 dchathu

Yes, you can use LUIS inside a scorable. You would call LUIS as normal, and process the result the same way you normally would when using LUIS. This changes the way you use the scorable, but the way you use LUIS is the same. The scorable changes because you need to inherit from LuisDialog<Object> and [LuisIntent("yourIntent")] attributes on your methods. here is a SO post about this that may help https://stackoverflow.com/questions/46557923/bot-framework-use-luis-in-scorables

JasonSowers avatar Oct 04 '17 18:10 JasonSowers

So when I use LUIS inside scorable, won't it call the LUIS endpoint multiple times? Scorable captures each and every input.If I use LUIS to score the scorable,(1st endpoint call) I can select a scorable and call a dialog. When the dialog is called, since the dialog is a LUIS dialog, it will again call the LUIS to match the LUIS intent inside the LUIS dialog (2nd endpoint call). Am i correct?

dchathu avatar Oct 09 '17 07:10 dchathu

Hi Jason, We are trying to do the same with using LUIS in scorables, and because we are located in South Africa, the concern is that it would slow our bot down to call LUIS for every user message.

seca23 avatar Oct 19 '17 15:10 seca23

Sorry for the delay. Do you guys mind explaining your use cases so I can better understand what you are trying to accomplish, there may be a better way? thanks

JasonSowers avatar Oct 31 '17 22:10 JasonSowers

Hi Jason, I was trying to use LUIS to score a scorable. I was thinking to call LUIS in 'PrepareAsync' method, and based on the resulting intent, I could decide whether or not to further process the scorable. All the examples out there are using keywords to decide this. I find calling LUIS is a waste since it would call the LUIS for each and every user input.

To resolve this, what I did was, I used keywords in 'PrepareAsync' method to match the scorable and in the 'GetScore' method, I called the LUIS and returned the Score of the matching intent.

Even-though I am unable to match all the scenarios based on keywords, this is OK for me since I am able to reduce the number of LUIS calls.

Is there any other alternative to handle this?

dchathu avatar Nov 01 '17 06:11 dchathu

If I understand you correctly. What I would do is this, create your scorable and if your keywords logic gets used the scorable handle the request. If not the request will be sent to the RootDialog here I would forward to a LuisDialog to handle the request. This way you are not calling LUIS every time. So it sounds like this is what you are doing already. here is a sample I created using the code from here and just added the functionality you were describing. It a very simple example located here https://github.com/JasonSowers/scorableLuis

JasonSowers avatar Nov 01 '17 19:11 JasonSowers

Additionally our docs team just posted this blog https://blog.botframework.com/2017/11/10/dialog-management-qna-luis-scorables/

JasonSowers avatar Nov 14 '17 19:11 JasonSowers