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

How to change LUIS model dynamically

Open kenyeung128 opened this issue 10 years ago • 5 comments

Hi

How would it be possible to update the LUIS Model in LuisDialog dynamically? There is LuisModel attribute but I can't see where I could change this model dynamically, if user change the language. Thanks!

[LuisModel("xxxxxx-xxxxx-xxxxx-xxxx-xxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxx")]
[Serializable]
public class WelcomeDialog : LuisDialog<WelcomeScreen>{

}

kenyeung128 avatar Aug 25 '16 14:08 kenyeung128

The LuisDialog constructor takes an ILuisService:

https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Library/Dialogs/LuisDialog.cs#L146

You can implement ILuisService to select which underlying LuisService/LuisModelAttribute you'd like to use based on your language signal.

willportnoy avatar Aug 25 '16 16:08 willportnoy

@willportnoy Thanks for the answer. Do you know if that also applies to the Node.js version of the SDK?

palmerabollo avatar Aug 25 '16 18:08 palmerabollo

@Stevenic @muzahmed can you comment?

willportnoy avatar Aug 25 '16 19:08 willportnoy

@willportnoy @palmerabollo The Node.JS IntentDialog constructor takes a list of IIntentRecognizer's. The recognizer's are passed a context which includes dialogData and the message object. One approach would be to implement your own IIntentRecognizer which just shims your language-specific LUIS models based on, for example, a language flag in dialogData or on the message.

jorenl avatar Aug 26 '16 22:08 jorenl

Thanks @willportnoy , so I will have 2 seperate dialogs with different language LUIS Service.

kenyeung128 avatar Aug 27 '16 09:08 kenyeung128