LanguageServiceUtils class

用于使用语言服务的查询知识库和添加主动学习反馈 API 的实用工具。

构造函数

LanguageServiceUtils(QnAMakerOptions, QnAMakerEndpoint)

创建新的语言服务。

属性

endpoint
httpRequestUtils

方法

addFeedback(FeedbackRecords)

将反馈添加到知识库。

emitTraceInfo(TurnContext, QnAMakerResult[], QnAMakerOptions)

发出跟踪事件,详细说明自定义问答调用及其结果。

queryKnowledgebaseRaw(string, QnAMakerOptions)

调用 以查询语言服务。

validateOptions(QnAMakerOptions)

验证 qna maker 选项

构造函数详细信息

LanguageServiceUtils(QnAMakerOptions, QnAMakerEndpoint)

创建新的语言服务。

new LanguageServiceUtils(_options: QnAMakerOptions, endpoint: QnAMakerEndpoint)

参数

_options
QnAMakerOptions

用于配置实例的设置。

endpoint
QnAMakerEndpoint

要查询的知识库的终结点。

属性详细信息

endpoint

endpoint: QnAMakerEndpoint

属性值

httpRequestUtils

httpRequestUtils: HttpRequestUtils

属性值

方法详细信息

addFeedback(FeedbackRecords)

将反馈添加到知识库。

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

参数

feedbackRecords
FeedbackRecords

主动学习的反馈记录列表。

返回

Promise<void>

表示异步操作的承诺。

emitTraceInfo(TurnContext, QnAMakerResult[], QnAMakerOptions)

发出跟踪事件,详细说明自定义问答调用及其结果。

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

参数

turnContext

TurnContext

为与用户当前轮次的对话转上下文。

answers

QnAMakerResult[]

语言服务返回的答案。

queryOptions
QnAMakerOptions

(可选) 自定义问题解答知识库的选项。 如果为 null,则此实例使用构造函数选项。

返回

Promise<any>

表示异步操作的承诺

queryKnowledgebaseRaw(string, QnAMakerOptions)

调用 以查询语言服务。

function queryKnowledgebaseRaw(question: string, options?: QnAMakerOptions): Promise<QnAMakerResults>

参数

question

string

需要查询的问题。

options
QnAMakerOptions

(可选) QnA Maker 知识库的选项。 如果为 null,则此实例使用构造函数选项。

返回

Promise<QnAMakerResults>

解析为原始查询结果的承诺

validateOptions(QnAMakerOptions)

验证 qna maker 选项

function validateOptions(options: QnAMakerOptions)

参数

options
QnAMakerOptions

自定义问答知识库的选项。 如果为 null,则此实例使用构造函数选项。