2

Is it possible to use LUIS API without MS BOT Framework? It is ok if I need to reference MS BOT Framework libraries for parsing LUIS response, but incoming request text will be from web application and not from MS BOT Framework. I am struggling to found recent proper nuget package, which will provide parsing capability and context management. So for example if bot asked for name and phone and user provided only name, bot will be able to ask for missing phone.

Vladimir B
  • 170
  • 1
  • 13

1 Answers1

3

If you want to use LUIS easily in C#, without using it inside Bot Framework, you can use Microsoft.Cognitive.LUIS package available on Nuget (see here)

This package contains the methods to query LUIS.

Sample:

private async Task QueryLuis(string querySentence)
{
    var client = new LuisClient("appId", "appKey", domain: "westeurope");
    var luisResult = await client.Predict("Text sent to LUIS for prediction");

    Console.WriteLine($"{luisResult.Intents.Select(i => $"Intent '{i.Name}' with score {i.Score}")}\r\n");
}

I guess in the future it may be included in a different package because as you can see in this psSdkJson6 branch of azure-sdk-for-net Github's project, there are also classes for LUIS Runtime available here

Nicolas R
  • 13,812
  • 2
  • 28
  • 57
  • Thanks this is exactly what I am looking for. What about my second part - how to manage context? – Vladimir B May 28 '18 at 12:57
  • This "context" you are talking about is the job of your (bot or not) code, LUIS is only a Natural Language Processing tool – Nicolas R May 28 '18 at 13:01
  • the Microsoft.Cognitive.LUIS has in response DialogResponse property. So seems it can be used together with MS BOT Framework for keep context of the dialogs. May be exist a way to instantiate dialog and pass them to LUIS? I just compare solution to Watson, where questions configured in system and I pass context to the service. – Vladimir B May 29 '18 at 08:55
  • If you have a look to Github, I don't think there is such a possibility. There was just a deprecated `contextId` property: https://github.com/Microsoft/Cognitive-LUIS-Windows/blob/master/CSharp/Microsoft.Cognitive.LUIS/LuisService.cs#L93 – Nicolas R May 29 '18 at 09:20
  • what about below ? https://blog.botframework.com/2017/04/06/luis-action-binding-web/ seems this is exactly what I am looking for? – Vladimir B May 29 '18 at 11:18
  • This is not on the same package, here the post is related to Bot Framework but you were asking for using LUIS API without bot framework... – Nicolas R May 29 '18 at 11:25
  • I don't mind to reference MS Bot libraries, in that blog (if I understand correct) examples are for using LUIS standalone from console or from web application , right? – Vladimir B May 29 '18 at 11:28
  • Looks like it is, yes – Nicolas R May 29 '18 at 11:55