Reputation: 163
I am using a Microsoft bot builder SDKv4 for creating a Chat bot using LUIS.ai for getting the top intent. I used the following code to configure luis in my .net core 2.1 project.
public BotServices(IConfiguration configuration)
{
// Read the setting for cognitive services from the appsettings.json
Dispatch = new LuisRecognizer(new LuisApplication(
configuration["LuisAppId"],
configuration["LuisAPIKey"],
$"https://{configuration["LuisAPIHostName"]}.api.cognitive.microsoft.com"),
new LuisPredictionOptions { IncludeAllIntents = true, IncludeInstanceData = true },
true);
}
But I am getting this warning : "LuisRecognizer,LuisRecognizer ... is obsolete: ... please use LuisRecognizer(LuisRecognizerOptions recognizer)".
I followed this Microsoft tutorial to set it up. Even following the tutorial also gives the same "obsolete" error at line:
Dispatch = new LuisRecognizer(luisApplication);
https://learn.microsoft.com/en-us/azure/cognitive-services/luis/luis-csharp-tutorial-bf-v4
How can I configure luis in this case?
Thanks :)
Upvotes: 0
Views: 626
Reputation: 8292
The tutorial appears to be out of date. Please refer to the samples for the most up-to-date code. https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/csharp_dotnetcore/13.core-bot/FlightBookingRecognizer.cs#L27
var luisApplication = new LuisApplication(
configuration["LuisAppId"],
configuration["LuisAPIKey"],
"https://" + configuration["LuisAPIHostName"]);
var recognizerOptions = new LuisRecognizerOptionsV3(luisApplication)
{
PredictionOptions = new Bot.Builder.AI.LuisV3.LuisPredictionOptions
{
IncludeInstanceData = true,
}
};
Dispatch = new LuisRecognizer(recognizerOptions);
With app setting:
"LuisAPIHostName": "westus.api.cognitive.microsoft.com"
Upvotes: 4