GenerateAnswerUtils class

Generate Answer api utils class.

Constructors

GenerateAnswerUtils(QnAMakerOptions, QnAMakerEndpoint)

Creates new Generate answer utils.

Properties

httpRequestUtils

Methods

emitTraceInfo(TurnContext, QnAMakerResult[], QnAMakerOptions)

Emits a trace event detailing a QnA Maker call and its results.

queryQnaService(QnAMakerEndpoint, string, QnAMakerOptions)

Called internally to query the QnA Maker service.

queryQnaServiceRaw(QnAMakerEndpoint, string, QnAMakerOptions)

Called internally to query the QnA Maker service.

validateOptions(QnAMakerOptions)

Validate qna maker options

Constructor Details

GenerateAnswerUtils(QnAMakerOptions, QnAMakerEndpoint)

Creates new Generate answer utils.

new GenerateAnswerUtils(_options: QnAMakerOptions, endpoint: QnAMakerEndpoint)

Parameters

_options
QnAMakerOptions

Settings used to configure the instance.

endpoint
QnAMakerEndpoint

The endpoint of the knowledge base to query.

Property Details

httpRequestUtils

httpRequestUtils: HttpRequestUtils

Property Value

Method Details

emitTraceInfo(TurnContext, QnAMakerResult[], QnAMakerOptions)

Emits a trace event detailing a QnA Maker call and its results.

function emitTraceInfo(turnContext: TurnContext, answers: QnAMakerResult[], queryOptions?: QnAMakerOptions): Promise<any>

Parameters

turnContext

TurnContext

Turn Context for the current turn of conversation with the user.

answers

QnAMakerResult[]

Answers returned by QnA Maker.

queryOptions
QnAMakerOptions

(Optional) The options for the QnA Maker knowledge base. If null, constructor option is used for this instance.

Returns

Promise<any>

a promise representing the async operation

queryQnaService(QnAMakerEndpoint, string, QnAMakerOptions)

Called internally to query the QnA Maker service.

function queryQnaService(endpoint: QnAMakerEndpoint, question: string, options?: QnAMakerOptions): Promise<QnAMakerResult[]>

Parameters

endpoint
QnAMakerEndpoint

The endpoint of the knowledge base to query.

question

string

Question which need to be queried.

options
QnAMakerOptions

(Optional) The options for the QnA Maker knowledge base. If null, constructor option is used for this instance.

Returns

Promise<QnAMakerResult[]>

a promise that resolves to the query results. .

queryQnaServiceRaw(QnAMakerEndpoint, string, QnAMakerOptions)

Called internally to query the QnA Maker service.

function queryQnaServiceRaw(endpoint: QnAMakerEndpoint, question: string, options?: QnAMakerOptions): Promise<QnAMakerResults>

Parameters

endpoint
QnAMakerEndpoint

The endpoint of the knowledge base to query.

question

string

Question which need to be queried.

options
QnAMakerOptions

(Optional) The options for the QnA Maker knowledge base. If null, constructor option is used for this instance.

Returns

Promise<QnAMakerResults>

a promise that resolves to the raw query results

validateOptions(QnAMakerOptions)

Validate qna maker options

function validateOptions(options: QnAMakerOptions)

Parameters

options
QnAMakerOptions

The options for the QnA Maker knowledge base. If null, constructor option is used for this instance.