【问题标题】:On watson conversation panel how to set the intent right on the respond json?在 Watson 对话面板上,如何在响应 json 上设置意图?
【发布时间】:2018-06-19 22:46:16
【问题描述】:

我正在 watson conversaton 上建立一个对话,并且在某一点上,与我的“响应”json 一起,我还将链接为用户设置一个新的意图,我试图将它添加到 json,但是没有结果。

有办法做到这一点吗?

【问题讨论】:

    标签: json ibm-watson watson-conversation


    【解决方案1】:

    正如您在Official documentation 中看到的,您可以使用context variables 来保存值。

    上下文变量是您在节点中定义的变量,并且 可选地指定一个默认值。其他节点或应用程序 逻辑可以随后设置或更改上下文的值 变量。

    因此,在这种情况下,您将在 JSON 高级(如您的示例)中创建如下内容:

    {
      "context": {
        "intent": "fgts",
        "confidence": 1
      },
      "output": {
        "text": {
          "values": [
            "Your text here"
          ],
          "selection_policy": "sequential"
        }
      }
    }
    

    在您的后端应用程序中,您可以通过 POST /message 访问响应 JSON 对象中的值,例如:response.context.intentresponse.context.confidence

    Obs.默认,Watson Conversation 服务将返回 Watson 识别的 intent 的名称和 confidence 级别。

    如果你真的想按照这些说明使用你的方法。您可以在下面看到我的示例:

    {
      "output": {
        "text": {
          "values": [
            "text here"
          ],
          "selection_policy": "sequential"
        },
        "intents": "test"
      }
    }
    

    您的应用返回:

    { intents: [ { intent: 'helpBot', confidence: 0.5930036529133407 } ],
      entities: [],
      input: { text: 'ajuda' },
      output:
       { text: [ 'text here' ],
         nodes_visited: [ 'node_16_1511443279233' ],
         intents: 'test',
         log_messages: [] },
      context:
       { conversation_id: '83d88b05-7c76-457d-bd5f-7820be455a3e',
         system:
          { dialog_stack: [Object],
            dialog_turn_counter: 2,
            dialog_request_counter: 2,
            _node_output_map: [Object],
            branch_exited: true,
            branch_exited_reason: 'fallback' } } }
    

    【讨论】:

    • 好的,我知道我可以使用上下文变量,但我的答案是其他的,我想通过 json 设置意图...(#intent)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-01
    • 1970-01-01
    • 2020-08-28
    • 1970-01-01
    • 1970-01-01
    • 2016-05-13
    相关资源
    最近更新 更多