forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BotServices.cs
56 lines (52 loc) · 2.74 KB
/
BotServices.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License
using System;
using System.Collections.Generic;
using Microsoft.ApplicationInsights;
using Microsoft.Bot.Builder.AI.Luis;
namespace Microsoft.BotBuilderSamples
{
/// <summary>
/// Represents references to external services.
///
/// For example, LUIS services are kept here as a singleton. This external service is configured
/// using the <see cref="BotConfiguration"/> class.
/// </summary>
/// <seealso cref="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-2.1"/>
/// <seealso cref="https://www.luis.ai/home"/>
/// <seealso cref="https://azure.microsoft.com/en-us/services/application-insights/"/>
public class BotServices
{
/// <summary>
/// Initializes a new instance of the <see cref="BotServices"/> class.
/// </summary>
/// <param name="client">An Application Insights <see cref="TelemetryClient"/> instance.</param>
/// <param name="luisServices">A dictionary of named <see cref="LuisRecognizer"/> instances for usage within the bot.</param>
public BotServices(TelemetryClient client, Dictionary<string, LuisRecognizer> luisServices)
{
TelemetryClient = client ?? throw new ArgumentNullException(nameof(client));
LuisServices = luisServices ?? throw new ArgumentNullException(nameof(luisServices));
}
/// <summary>
/// Gets the Application Insights Telemetry client.
/// Use this to log new custom events/metrics/traces/etc into your
/// Application Insights service for later analysis.
/// </summary>
/// <value>
/// The Application Insights <see cref="TelemetryClient"/> instance created based on configuration in the .bot file.
/// </value>
/// <seealso cref="https://docs.microsoft.com/en-us/dotnet/api/microsoft.applicationinsights.telemetryclient?view=azure-dotnet"/>
public TelemetryClient TelemetryClient { get; }
/// <summary>
/// Gets the set of LUIS Services used.
/// Given there can be multiple <see cref="LuisRecognizer"/> services used in a single bot,
/// LuisServices is represented as a dictionary. This is also modeled in the
/// ".bot" file since the elements are named.
/// </summary>
/// <remarks>The LUIS services collection should not be modified while the bot is running.</remarks>
/// <value>
/// A <see cref="LuisRecognizer"/> client instance created based on configuration in the .bot file.
/// </value>
public Dictionary<string, LuisRecognizer> LuisServices { get; } = new Dictionary<string, LuisRecognizer>();
}
}