Skip to content

Instantly share code, notes, and snippets.

@arafattehsin
Created October 30, 2019 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arafattehsin/72ae355cc247d2fb7690deb21453248e to your computer and use it in GitHub Desktop.
Save arafattehsin/72ae355cc247d2fb7690deb21453248e to your computer and use it in GitHub Desktop.
Class to read configuration and assigning them to the respective language models and knowledge sources such as LUIS, QnA and Virtual Agent
public class BotServices : IBotServices
{
public BotServices(IConfiguration configuration)
{
// Read the setting for cognitive services (LUIS, QnA) from the appsettings.json
// If includeApiResults is set to true, the full response from the LUIS api (LuisResult)
// will be made available in the properties collection of the RecognizerResult
VABotDispatch = new LuisRecognizer(new LuisApplication(
configuration["LuisAppId"],
configuration["LuisAPIKey"],
$"https://{configuration["LuisAPIHostName"]}.api.cognitive.microsoft.com"),
new LuisPredictionOptions { IncludeAllIntents = true, IncludeInstanceData = true },
includeApiResults: true);
VABotService = new VABotService(new VABotEndpoint(
configuration["VABotId"],
configuration["VABotTenantId"],
configuration["VABotTokenEndpoint"]),
configuration["VABotName"]
);
}
public LuisRecognizer VABotDispatch { get; private set; }
public VABotService VABotService { get; private set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment