CustomQuestionAnswering class

Query a Custom Question Answering knowledge base for answers and provide feedbacks.

Constructors

CustomQuestionAnswering(QnAMakerEndpoint, QnAMakerOptions, BotTelemetryClient, boolean)

Creates a new CustomQuestionAnswering instance.

Properties

logPersonalInformation

Gets a value indicating whether determines whether to log personal information that came from the user.

telemetryClient

Gets the currently configured BotTelemetryClient that logs the events.

Methods

callTrain(FeedbackRecords)

Send feedback to the knowledge base.

getAnswers(TurnContext, QnAMakerOptions, [key: string]: string, [key: string]: number)

Calls the Language service to generate answer(s) for a question.

getAnswersRaw(TurnContext, QnAMakerOptions, [key: string]: string, [key: string]: number)

Generates an answer from the knowledge base.

getKnowledgebaseAnswersRaw(TurnContext, QnAMakerOptions, [key: string]: string, [key: string]: number)

Queries for answers from the Language Service project's knowledge base.

getLowScoreVariation(QnAMakerResult[])

Filters the ambiguous question for active learning.

Constructor Details

CustomQuestionAnswering(QnAMakerEndpoint, QnAMakerOptions, BotTelemetryClient, boolean)

Creates a new CustomQuestionAnswering instance.

new CustomQuestionAnswering(endpoint: QnAMakerEndpoint, options?: QnAMakerOptions, telemetryClient?: BotTelemetryClient, logPersonalInformation?: boolean)

Parameters

endpoint
QnAMakerEndpoint

The endpoint of the knowledge base to query.

options
QnAMakerOptions

(Optional) additional settings used to configure the instance.

telemetryClient

BotTelemetryClient

The BotTelemetryClient used for logging telemetry events.

logPersonalInformation

boolean

Set to true to include personally indentifiable information in telemetry events.

Property Details

logPersonalInformation

Gets a value indicating whether determines whether to log personal information that came from the user.

boolean logPersonalInformation

Property Value

boolean

True to determine whether to log personal information that came from the user; otherwise, false.

telemetryClient

Gets the currently configured BotTelemetryClient that logs the events.

BotTelemetryClient telemetryClient

Property Value

BotTelemetryClient

Currently configured BotTelemetryClient that logs the events.

Method Details

callTrain(FeedbackRecords)

Send feedback to the knowledge base.

function callTrain(feedbackRecords: FeedbackRecords): Promise<void>

Parameters

feedbackRecords
FeedbackRecords

FeedbackRecords for Active Learning.

Returns

Promise<void>

A promise representing the async operation.

getAnswers(TurnContext, QnAMakerOptions, [key: string]: string, [key: string]: number)

Calls the Language service to generate answer(s) for a question.

function getAnswers(context: TurnContext, options?: QnAMakerOptions, telemetryProperties?: [key: string]: string, telemetryMetrics?: [key: string]: number): Promise<QnAMakerResult[]>

Parameters

context

TurnContext

The Turn Context that contains the user question to be queried against your knowledge base.

options
QnAMakerOptions

(Optional) The options for the Custom Question Answering knowledge base. If null, constructor option is used for this instance.

telemetryProperties

[key: string]: string

Additional properties to be logged to telemetry with the QnaMessage event.

telemetryMetrics

[key: string]: number

Additional metrics to be logged to telemetry with the QnaMessage event.

Returns

Promise<QnAMakerResult[]>

A promise resolving to the QnAMaker result

getAnswersRaw(TurnContext, QnAMakerOptions, [key: string]: string, [key: string]: number)

Generates an answer from the knowledge base.

function getAnswersRaw(context: TurnContext, options: QnAMakerOptions, telemetryProperties: [key: string]: string, telemetryMetrics: [key: string]: number): Promise<QnAMakerResults>

Parameters

context

TurnContext

The TurnContext that contains the user question to be queried against your knowledge base.

options
QnAMakerOptions

Optional. The QnAMakerOptions for the Custom Question Answering knowledge base. If null, constructor option is used for this instance.

telemetryProperties

[key: string]: string

Optional. Additional properties to be logged to telemetry with the QnaMessage event.

telemetryMetrics

[key: string]: number

Optional. Additional metrics to be logged to telemetry with the QnaMessage event.

Returns

Promise<QnAMakerResults>

A list of answers for the user query, sorted in decreasing order of ranking score.

getKnowledgebaseAnswersRaw(TurnContext, QnAMakerOptions, [key: string]: string, [key: string]: number)

Queries for answers from the Language Service project's knowledge base.

function getKnowledgebaseAnswersRaw(context: TurnContext, options: QnAMakerOptions, telemetryProperties: [key: string]: string, telemetryMetrics: [key: string]: number): Promise<QnAMakerResults>

Parameters

context

TurnContext

The TurnContext that contains the user question to be queried against your knowledge base.

options
QnAMakerOptions

Optional. The QnAMakerOptions for the Language Service project's knowledge base. If null, constructor option is used for this instance.

telemetryProperties

[key: string]: string

Optional. Additional properties to be logged to telemetry with the QnaMessage event.

telemetryMetrics

[key: string]: number

Optional. Additional metrics to be logged to telemetry with the QnaMessage event.

Returns

Promise<QnAMakerResults>

A list of answers for the user query, sorted in decreasing order of ranking score.

getLowScoreVariation(QnAMakerResult[])

Filters the ambiguous question for active learning.

function getLowScoreVariation(queryResult: QnAMakerResult[]): QnAMakerResult[]

Parameters

queryResult

QnAMakerResult[]

User query output.

Returns

the filtered results