diff --git a/libraries/botbuilder-ai/etc/botbuilder-ai.api.md b/libraries/botbuilder-ai/etc/botbuilder-ai.api.md index e51c151061..338f4c4382 100644 --- a/libraries/botbuilder-ai/etc/botbuilder-ai.api.md +++ b/libraries/botbuilder-ai/etc/botbuilder-ai.api.md @@ -86,14 +86,12 @@ export class CustomQuestionAnswering implements QnAMakerClient_2, QnAMakerTeleme [key: string]: number; }): Promise; getLowScoreVariation(queryResult: QnAMakerResult[]): QnAMakerResult[]; - // (undocumented) get logPersonalInformation(): boolean; protected onQnaResults(qnaResults: QnAMakerResult[], turnContext: TurnContext, telemetryProperties?: { [key: string]: string; }, telemetryMetrics?: { [key: string]: number; }): Promise; - // (undocumented) get telemetryClient(): BotTelemetryClient; } @@ -278,7 +276,7 @@ export interface LuisApplication { endpointKey: string; } -// @public (undocumented) +// @public export class LuisBotComponent extends BotComponent { // (undocumented) configureServices(services: ServiceCollection, _configuration: Configuration): void; @@ -313,7 +311,6 @@ export class LuisRecognizer implements LuisRecognizerTelemetryClient { }): Promise<{ [key: string]: string; }>; - // (undocumented) get logPersonalInformation(): boolean; protected onRecognizerResults(recognizerResult: RecognizerResult, turnContext: TurnContext, telemetryProperties?: { [key: string]: string; @@ -326,7 +323,6 @@ export class LuisRecognizer implements LuisRecognizerTelemetryClient { intent: string; score: number; }>; - // (undocumented) get telemetryClient(): BotTelemetryClient; static topIntent(results?: RecognizerResult, defaultIntent?: string, minScore?: number): string; } @@ -460,14 +456,12 @@ export class QnAMaker implements QnAMakerClient, QnAMakerTelemetryClient { [key: string]: number; }): Promise; getLowScoreVariation(queryResult: QnAMakerResult[]): QnAMakerResult[]; - // (undocumented) get logPersonalInformation(): boolean; protected onQnaResults(qnaResults: QnAMakerResult[], turnContext: TurnContext, telemetryProperties?: { [key: string]: string; }, telemetryMetrics?: { [key: string]: number; }): Promise; - // (undocumented) get telemetryClient(): BotTelemetryClient; } @@ -480,7 +474,7 @@ export const QNAMAKER_TRACE_NAME = "QnAMaker"; // @public (undocumented) export const QNAMAKER_TRACE_TYPE = "https://www.qnamaker.ai/schemas/trace"; -// @public (undocumented) +// @public export class QnAMakerBotComponent extends BotComponent { // (undocumented) configureServices(services: ServiceCollection, _configuration: Configuration): void; diff --git a/libraries/botbuilder-ai/package.json b/libraries/botbuilder-ai/package.json index 1c4efd9eac..5af7b7f04a 100644 --- a/libraries/botbuilder-ai/package.json +++ b/libraries/botbuilder-ai/package.json @@ -30,6 +30,8 @@ "@azure/cognitiveservices-luis-runtime": "2.0.0", "@azure/ms-rest-js": "1.9.1", "adaptive-expressions": "4.1.6", + "botbuilder-core": "4.1.6", + "botbuilder-dialogs": "4.1.6", "botbuilder-dialogs-adaptive-runtime-core": "4.1.6", "botbuilder-dialogs-declarative": "4.1.6", "lodash": "^4.17.21", @@ -42,8 +44,6 @@ }, "devDependencies": { "@types/node-fetch": "^2.5.7", - "botbuilder-core": "4.1.6", - "botbuilder-dialogs": "4.1.6", "fs-extra": "^7.0.1", "nock": "^11.9.1" }, diff --git a/libraries/botbuilder-ai/src/customQuestionAnswering.ts b/libraries/botbuilder-ai/src/customQuestionAnswering.ts index 0bad42053c..1b20622e39 100644 --- a/libraries/botbuilder-ai/src/customQuestionAnswering.ts +++ b/libraries/botbuilder-ai/src/customQuestionAnswering.ts @@ -178,12 +178,20 @@ export class CustomQuestionAnswering implements QnAMakerClient, QnAMakerTelemetr this._logPersonalInformation = logPersonalInformation || false; } - // Gets a value indicating whether determines whether to log personal information that came from the user. + /** + * Gets a value indicating whether determines whether to log personal information that came from the user. + * + * @returns True to determine whether to log personal information that came from the user; otherwise, false. + */ get logPersonalInformation(): boolean { return this._logPersonalInformation; } - // Gets the currently configured botTelemetryClient that logs the events. + /** + * Gets the currently configured BotTelemetryClient that logs the events. + * + * @returns Currently configured BotTelemetryClient that logs the events. + */ get telemetryClient(): BotTelemetryClient { return this._telemetryClient; } diff --git a/libraries/botbuilder-ai/src/luisAdaptivePredictionOptions.ts b/libraries/botbuilder-ai/src/luisAdaptivePredictionOptions.ts index 4abaa3e659..3fefd876aa 100644 --- a/libraries/botbuilder-ai/src/luisAdaptivePredictionOptions.ts +++ b/libraries/botbuilder-ai/src/luisAdaptivePredictionOptions.ts @@ -59,9 +59,17 @@ export interface LuisAdaptivePredictionOptionsConfiguration { */ slot?: string | Expression | StringExpression; } - +/** + * Converts optional parameters for a LUIS prediction request. + */ export class LuisAdaptivePredictionOptionsConverter implements Converter { + /** + * Converts the provided options configuration into an object of [LuisAdaptivePredictionOptions](xref:botbuilder-ai.LuisAdaptivePredictionOptions) type. + * + * @param config Options configuration for LuisAdaptivePredictionOptions. + * @returns The converted options configuration to the [LuisAdaptivePredictionOptions](xref:botbuilder-ai.LuisAdaptivePredictionOptions) interface. + */ convert(config: LuisAdaptivePredictionOptionsConfiguration): LuisAdaptivePredictionOptions { const options = Object.entries(config).reduce((options: LuisAdaptivePredictionOptions, [key, value]) => { switch (key) { diff --git a/libraries/botbuilder-ai/src/luisAdaptiveRecognizer.ts b/libraries/botbuilder-ai/src/luisAdaptiveRecognizer.ts index 9c4046f133..2350150f8b 100644 --- a/libraries/botbuilder-ai/src/luisAdaptiveRecognizer.ts +++ b/libraries/botbuilder-ai/src/luisAdaptiveRecognizer.ts @@ -105,6 +105,10 @@ export class LuisAdaptiveRecognizer extends Recognizer implements LuisAdaptiveRe '=settings.runtimeSettings.telemetry.logPersonalInformation' ); + /** + * @param property Properties that extend RecognizerConfiguration. + * @returns Expression converter. + */ getConverter(property: keyof LuisAdaptiveRecognizerConfiguration): Converter | ConverterFactory { switch (property) { case 'applicationId': diff --git a/libraries/botbuilder-ai/src/luisBotComponent.ts b/libraries/botbuilder-ai/src/luisBotComponent.ts index 44f151dd58..f0a4ec698d 100644 --- a/libraries/botbuilder-ai/src/luisBotComponent.ts +++ b/libraries/botbuilder-ai/src/luisBotComponent.ts @@ -6,7 +6,14 @@ import { ComponentDeclarativeTypes } from 'botbuilder-dialogs-declarative'; import { Configuration, ServiceCollection } from 'botbuilder-dialogs-adaptive-runtime-core'; import { LuisAdaptiveRecognizer } from './luisAdaptiveRecognizer'; +/** + *LUIS @see cref="BotComponent" definition. + */ export class LuisBotComponent extends BotComponent { + /** + * @param services Services collection to register dependency injection. + * @param _configuration Configuration for the bot component. + */ configureServices(services: ServiceCollection, _configuration: Configuration): void { services.composeFactory('declarativeTypes', (declarativeTypes) => declarativeTypes.concat({ diff --git a/libraries/botbuilder-ai/src/luisComponentRegistration.ts b/libraries/botbuilder-ai/src/luisComponentRegistration.ts index a7f30dc321..c221037180 100644 --- a/libraries/botbuilder-ai/src/luisComponentRegistration.ts +++ b/libraries/botbuilder-ai/src/luisComponentRegistration.ts @@ -19,6 +19,9 @@ export class LuisComponentRegistration extends ComponentRegistration { declarativeTypes: [], }); + /** + * Define component assets for Luis. + */ constructor() { super(); diff --git a/libraries/botbuilder-ai/src/luisRecognizer.ts b/libraries/botbuilder-ai/src/luisRecognizer.ts index faa4bdb071..2d3a78bc5a 100644 --- a/libraries/botbuilder-ai/src/luisRecognizer.ts +++ b/libraries/botbuilder-ai/src/luisRecognizer.ts @@ -343,12 +343,20 @@ export class LuisRecognizer implements LuisRecognizerTelemetryClient { } } - // Gets a value indicating whether determines whether to log personal information that came from the user. + /** + * Gets a value indicating whether determines whether to log personal information that came from the user. + * + * @returns True if will log personal information into the BotTelemetryClient.TrackEvent method; otherwise the properties will be filtered. + */ get logPersonalInformation(): boolean { return this._logPersonalInformation; } - // Gets the currently configured botTelemetryClient that logs the events. + /** + * Gets the currently configured BotTelemetryClient that logs the events. + * + * @returns Currently configured BotTelemetryClient that logs the LuisResult event. + */ get telemetryClient(): BotTelemetryClient { return this._telemetryClient; } diff --git a/libraries/botbuilder-ai/src/qnaMaker.ts b/libraries/botbuilder-ai/src/qnaMaker.ts index 3e79c10dad..61aa4f665d 100644 --- a/libraries/botbuilder-ai/src/qnaMaker.ts +++ b/libraries/botbuilder-ai/src/qnaMaker.ts @@ -140,7 +140,7 @@ export class QnAMaker implements QnAMakerClient, QnAMakerTelemetryClient { * @param {QnAMakerEndpoint} endpoint The endpoint of the knowledge base to query. * @param {QnAMakerOptions} options (Optional) additional settings used to configure the instance. * @param {BotTelemetryClient} telemetryClient The BotTelemetryClient used for logging telemetry events. - * @param {boolean} logPersonalInformation Set to true to include personally indentifiable information in telemetry events. + * @param {boolean} logPersonalInformation Set to true to include personally identifiable information in telemetry events. */ constructor( private readonly endpoint: QnAMakerEndpoint, @@ -179,12 +179,20 @@ export class QnAMaker implements QnAMakerClient, QnAMakerTelemetryClient { this._logPersonalInformation = logPersonalInformation || false; } - // Gets a value indicating whether determines whether to log personal information that came from the user. + /** + * Gets a value indicating whether determines whether to log personal information that came from the user. + * + * @returns True if will log personal information into the BotTelemetryClient.TrackEvent method; otherwise the properties will be filtered. + */ get logPersonalInformation(): boolean { return this._logPersonalInformation; } - // Gets the currently configured botTelemetryClient that logs the events. + /** + * Gets the currently configured BotTelemetryClient that logs the events. + * + * @returns The currently configured BotTelemetryClient that logs the QnaMessage event. + */ get telemetryClient(): BotTelemetryClient { return this._telemetryClient; } diff --git a/libraries/botbuilder-ai/src/qnaMakerBotComponent.ts b/libraries/botbuilder-ai/src/qnaMakerBotComponent.ts index 2aa1c144c5..d0ae9099f2 100644 --- a/libraries/botbuilder-ai/src/qnaMakerBotComponent.ts +++ b/libraries/botbuilder-ai/src/qnaMakerBotComponent.ts @@ -7,7 +7,14 @@ import { Configuration, ServiceCollection } from 'botbuilder-dialogs-adaptive-ru import { QnAMakerDialog } from './qnaMakerDialog'; import { QnAMakerRecognizer } from './qnaMakerRecognizer'; +/** + * Class which contains registration of components for QnAMaker. + */ export class QnAMakerBotComponent extends BotComponent { + /** + * @param services Services collection to mimic dependency injection. + * @param _configuration Configuration for the bot component. + */ configureServices(services: ServiceCollection, _configuration: Configuration): void { services.composeFactory('declarativeTypes', (declarativeTypes) => declarativeTypes.concat({ diff --git a/libraries/botbuilder-ai/src/qnaMakerComponentRegistration.ts b/libraries/botbuilder-ai/src/qnaMakerComponentRegistration.ts index 5b03a23de9..c0f7f98eb7 100644 --- a/libraries/botbuilder-ai/src/qnaMakerComponentRegistration.ts +++ b/libraries/botbuilder-ai/src/qnaMakerComponentRegistration.ts @@ -19,6 +19,9 @@ export class QnAMakerComponentRegistration extends ComponentRegistration { declarativeTypes: [], }); + /** + * Create an instance of QnAMakerComponentRegistration. + */ constructor() { super(); diff --git a/libraries/botbuilder-ai/src/qnaMakerDialog.ts b/libraries/botbuilder-ai/src/qnaMakerDialog.ts index 765a58d9d6..9ba7505aa4 100644 --- a/libraries/botbuilder-ai/src/qnaMakerDialog.ts +++ b/libraries/botbuilder-ai/src/qnaMakerDialog.ts @@ -488,6 +488,10 @@ export class QnAMakerDialog extends WaterfallDialog implements QnAMakerDialogCon this.addStep(this.displayQnAResult.bind(this)); } + /** + * @param property Properties that extend QnAMakerDialogConfiguration. + * @returns The expression converter. + */ getConverter(property: keyof QnAMakerDialogConfiguration): Converter | ConverterFactory { switch (property) { case 'knowledgeBaseId': diff --git a/libraries/botbuilder-ai/src/qnaMakerRecognizer.ts b/libraries/botbuilder-ai/src/qnaMakerRecognizer.ts index a877d1a184..335ac94547 100644 --- a/libraries/botbuilder-ai/src/qnaMakerRecognizer.ts +++ b/libraries/botbuilder-ai/src/qnaMakerRecognizer.ts @@ -127,6 +127,10 @@ export class QnAMakerRecognizer extends Recognizer implements QnAMakerRecognizer '=settings.runtimeSettings.telemetry.logPersonalInformation' ); + /** + * @param property Properties that extend QnAMakerRecognizerConfiguration. + * @returns The expression converter. + */ getConverter(property: keyof QnAMakerRecognizerConfiguration): Converter | ConverterFactory { switch (property) { case 'knowledgeBaseId': diff --git a/libraries/botbuilder-ai/src/qnamaker-utils/bindToActivity.ts b/libraries/botbuilder-ai/src/qnamaker-utils/bindToActivity.ts index 5dc685e0c3..099115bb8b 100644 --- a/libraries/botbuilder-ai/src/qnamaker-utils/bindToActivity.ts +++ b/libraries/botbuilder-ai/src/qnamaker-utils/bindToActivity.ts @@ -9,9 +9,25 @@ import { Activity } from 'botbuilder-core'; import { DialogContext, TemplateInterface } from 'botbuilder-dialogs'; +/** + * Creates a new template to send the user based on the activity. + */ export class BindToActivity implements TemplateInterface> { + /** + * Initializes a new instance of the [BindToActivity](xref:botbuilder-ai.BindToActivity) class. + * + * @param activity The activity to send the user. + * @returns Template to send the user. + */ constructor(private readonly activity: Partial) {} + /** + * Binds the provided activity. + * + * @param _context The dialog context. + * @param _data Data to bind to. If Null, then dc.State will be used. + * @returns The linked activity. + */ // eslint-disable-next-line @typescript-eslint/ban-types async bind(_context: DialogContext, _data?: object): Promise> { return this.activity;