Skip to content

Commit

Permalink
Added telemetry client to LUIS and QnA recognizer for logging (micros…
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanisgrig authored May 13, 2019
1 parent 2354824 commit 801091b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// Licensed under the MIT License.

using System.Collections.Generic;
using Microsoft.ApplicationInsights;
using Microsoft.Bot.Builder.AI.Luis;
using Microsoft.Bot.Builder.AI.QnA;
using Microsoft.Bot.Builder.ApplicationInsights;
using Microsoft.Bot.Builder.Solutions;

namespace VirtualAssistantSample.Services
Expand All @@ -22,15 +24,23 @@ public BotServices(BotSettings settings)
var language = pair.Key;
var config = pair.Value;

var telemetryClient = new BotTelemetryClient(new TelemetryClient(settings.AppInsights));
var luisOptions = new LuisPredictionOptions()
{
TelemetryClient = telemetryClient,
LogPersonalInformation = true,
};

var dispatchApp = new LuisApplication(config.DispatchModel.AppId, config.DispatchModel.SubscriptionKey, config.DispatchModel.GetEndpoint());
set.DispatchService = new LuisRecognizer(dispatchApp);

set.DispatchService = new LuisRecognizer(dispatchApp, luisOptions);

if (config.LanguageModels != null)
{
foreach (var model in config.LanguageModels)
{
var luisApp = new LuisApplication(model.AppId, model.SubscriptionKey, model.GetEndpoint());
set.LuisServices.Add(model.Id, new LuisRecognizer(luisApp));
set.LuisServices.Add(model.Id, new LuisRecognizer(luisApp, luisOptions));
}
}

Expand All @@ -42,7 +52,8 @@ public BotServices(BotSettings settings)
EndpointKey = kb.EndpointKey,
Host = kb.Hostname,
};
var qnaMaker = new QnAMaker(qnaEndpoint);

var qnaMaker = new QnAMaker(qnaEndpoint, null, null, telemetryClient: telemetryClient, logPersonalInformation: true);
set.QnAServices.Add(kb.Id, qnaMaker);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// Licensed under the MIT License.

using System.Collections.Generic;
using Microsoft.ApplicationInsights;
using Microsoft.Bot.Builder.AI.Luis;
using Microsoft.Bot.Builder.AI.QnA;
using Microsoft.Bot.Builder.ApplicationInsights;
using Microsoft.Bot.Builder.Solutions;

namespace $safeprojectname$.Services
Expand All @@ -22,15 +24,23 @@ public BotServices(BotSettings settings)
var language = pair.Key;
var config = pair.Value;

var telemetryClient = new BotTelemetryClient(new TelemetryClient(settings.AppInsights));
var luisOptions = new LuisPredictionOptions()
{
TelemetryClient = telemetryClient,
LogPersonalInformation = true,
};

var dispatchApp = new LuisApplication(config.DispatchModel.AppId, config.DispatchModel.SubscriptionKey, config.DispatchModel.GetEndpoint());
set.DispatchService = new LuisRecognizer(dispatchApp);

set.DispatchService = new LuisRecognizer(dispatchApp, luisOptions);

if (config.LanguageModels != null)
{
foreach (var model in config.LanguageModels)
{
var luisApp = new LuisApplication(model.AppId, model.SubscriptionKey, model.GetEndpoint());
set.LuisServices.Add(model.Id, new LuisRecognizer(luisApp));
set.LuisServices.Add(model.Id, new LuisRecognizer(luisApp, luisOptions));
}
}

Expand All @@ -42,7 +52,8 @@ public BotServices(BotSettings settings)
EndpointKey = kb.EndpointKey,
Host = kb.Hostname,
};
var qnaMaker = new QnAMaker(qnaEndpoint);

var qnaMaker = new QnAMaker(qnaEndpoint, null, null, telemetryClient: telemetryClient, logPersonalInformation: true);
set.QnAServices.Add(kb.Id, qnaMaker);
}

Expand Down

0 comments on commit 801091b

Please sign in to comment.