/** * @module botbuilder-ai */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { TurnContext } from 'botbuilder-core'; import { QnAMakerResult } from '../qnamaker-interfaces/qnamakerResult'; import { QnAMakerResults } from '../qnamaker-interfaces/qnamakerResults'; import { QnAMakerEndpoint } from '../qnamaker-interfaces/qnamakerEndpoint'; import { QnAMakerOptions } from '../qnamaker-interfaces/qnamakerOptions'; import { HttpRequestUtils } from './httpRequestUtils'; /** * Generate Answer api utils class. * * @summary * This class is helper class for generate answer api, which is used to make queries to a single QnA Maker knowledge base and return the result. */ export declare class GenerateAnswerUtils { _options: QnAMakerOptions; private readonly endpoint; httpRequestUtils: HttpRequestUtils; /** * Creates new Generate answer utils. * * @param {QnAMakerOptions} _options Settings used to configure the instance. * @param {QnAMakerEndpoint} endpoint The endpoint of the knowledge base to query. */ constructor(_options: QnAMakerOptions, endpoint: QnAMakerEndpoint); /** * Called internally to query the QnA Maker service. * * @param {QnAMakerEndpoint} endpoint The endpoint of the knowledge base to query. * @param {string} question Question which need to be queried. * @param {QnAMakerOptions} options (Optional) The options for the QnA Maker knowledge base. If null, constructor option is used for this instance. * @returns {Promise} a promise that resolves to the query results. */ queryQnaService(endpoint: QnAMakerEndpoint, question: string, options?: QnAMakerOptions): Promise; /** * Called internally to query the QnA Maker service. * * @param {QnAMakerEndpoint} endpoint The endpoint of the knowledge base to query. * @param {string} question Question which need to be queried. * @param {QnAMakerOptions} options (Optional) The options for the QnA Maker knowledge base. If null, constructor option is used for this instance. * @returns {Promise} a promise that resolves to the raw query results */ queryQnaServiceRaw(endpoint: QnAMakerEndpoint, question: string, options?: QnAMakerOptions): Promise; /** * Emits a trace event detailing a QnA Maker call and its results. * * @param {TurnContext} turnContext Turn Context for the current turn of conversation with the user. * @param {QnAMakerResult[]} answers Answers returned by QnA Maker. * @param {QnAMakerOptions} queryOptions (Optional) The options for the QnA Maker knowledge base. If null, constructor option is used for this instance. * @returns {Promise} a promise representing the async operation */ emitTraceInfo(turnContext: TurnContext, answers: QnAMakerResult[], queryOptions?: QnAMakerOptions): Promise; /** * Validate qna maker options * * @param {QnAMakerOptions} options The options for the QnA Maker knowledge base. If null, constructor option is used for this instance. */ validateOptions(options: QnAMakerOptions): void; /** * Sorts all QnAMakerResult from highest-to-lowest scoring. * Filters QnAMakerResults within threshold specified (default threshold: .001). * * @param {QnAMakerResult[]} answers Answers returned by QnA Maker. * @param {QnAMakerOptions} queryOptions (Optional) The options for the QnA Maker knowledge base. If null, constructor option is used for this instance. * @returns {QnAMakerResult[]} the sorted and filtered results. */ static sortAnswersWithinThreshold(answers: QnAMakerResult[], queryOptions: QnAMakerOptions): QnAMakerResult[]; private formatQnaResult; private validateScoreThreshold; private validateTop; private getMetadata; } //# sourceMappingURL=generateAnswerUtils.d.ts.map