6

我们正在使用附加到Azure Bot Service的QnA Maker。在知识库 (KB) 中,我们为每个问题添加了后续提示This did NOT answer my question

知识库 > 跟进提示

这意味着如果提供了错误的响应,最终用户可以指出,对话历史将如下所示:

示例对话

我们试图做的是重播对话历史,以便我们可以看到:

  1. 原始用户提示
  2. 原来的答案
  3. 随后的后续问题/答案

我们打开了Application Insights,因此我们可以通过以下查询从日志中看到这两个问题:

traces
| project timestamp, 
          itemId,
          question = customDimensions.Question,
          answer = customDimensions.Answer
| order by timestamp

这将返回这两行:

App Insights 日志

但是,我们正在尝试找到可以关联这两个记录的唯一对话 ID 或会话 ID。请注意,两者itemId非常相似,但并不完全相同:

53be8c14-702c-11ea-8c41-11c1c266dc55
53be8c13-702c-11ea-8c41-11c1c266dc55

是否有可以用来加入这两个事件的唯一密钥?

一种解决方法是仅使用的前 7 位数字itemID并根据部分匹配加入,如下所示:

traces
| where customDimensions.Question contains "This did NOT answer my question" 
| project itemId,
          SessionID = extract("^[a-z0-9]{7}", 0, itemId),
          timestamp
| join (
    traces
    | extend question = tostring(customDimensions['Question'])
    | extend answer = tostring(customDimensions['Answer'])
    | where message contains "GenerateAnswer" 
        and question  !contains "This did NOT answer my question" 
    | project itemId,
              SessionID = extract("^[a-z0-9]{7}",0,itemId),
              question,
              answer,
              timestamp
) on SessionID 
| project question, answer, SessionID, timestamp //, itemId, itemId1
| order by timestamp desc, SessionID

但我们不确定该值是否可靠地仅相差第 8 位,因此更喜欢不那么脆弱的 ID

4

1 回答 1

-1

我最近实施了一个带有主动学习的 QnA maker BOT。

样本位于此处

它与您要实现的目标非常相似。

在此处输入图像描述

于 2020-03-31T06:48:29.800 回答