1

在我的 LUIS 应用程序中,我有一个名为 GetWeather 的意图,需要设置一个位置。以 Location 作为必需参数的 GetWeather 意图

使用查询连接到应用程序时

伦敦的天气怎么样

它正确返回

{
  "query": "what is the weather in london",
  "topScoringIntent": {
    "intent": "GetWeather",
    "score": 0.999875546,
    "actions": [
      {
        "triggered": true,
        "name": "GetWeather",
        "parameters": [
          {
            "name": "Location",
            "type": "Location",
            "required": true,
            "value": [
              {
                "entity": "london",
                "type": "Location",
                "resolution": {}
              }
            ]
          }
        ]
      }
    ]
  },
  "entities": [
    {
      "entity": "london",
      "type": "Location",
      "startIndex": 23,
      "endIndex": 28,
      "score": 0.832388461,
      "resolution": {}
    }
  ],
  "dialog": {
    "contextId": "e1df6c2d-e691-4fc6-89f2-3ee2ef519724",
    "status": "Finished"
  }
}

如果我改为使用查询

天气怎么样

它返回以下预期结果。

{
  "query": "what is the weather",
  "topScoringIntent": {
    "intent": "GetWeather",
    "score": 1.0,
    "actions": [
      {
        "triggered": false,
        "name": "GetWeather",
        "parameters": [
          {
            "name": "Location",
            "type": "Location",
            "required": true,
            "value": null
          }
        ]
      }
    ]
  },
  "entities": [],
  "dialog": {
    "prompt": "Where",
    "parameterName": "Location",
    "parameterType": "Location",
    "contextId": "3b0725f4-7d6f-43fd-ab6e-02fc11c3eed1",
    "status": "Question"
  }
}

我认为在下一次调用中使用 contextID 和 forceSet 参数会将参数 Location 设置为我作为查询发送的任何内容。我使用的连接字符串是这样的:

https://api.projectoxford.ai/luis/v2.0/apps/{APP_ID}?subscription-key={SUBSCRIPTION_KEY}&q=london&contextid=3b0725f4-7d6f-43fd-ab6e-02fc11c3eed1&forceset=Location

相反,我得到以下回复:

{
  "query": "london",
  "topScoringIntent": {
    "intent": "GetWeather",
    "score": 1.0,
    "actions": [
      {
        "triggered": false,
        "name": "GetWeather",
        "parameters": [
          {
            "name": "Location",
            "type": "Location",
            "required": true,
            "value": null
          }
        ]
      }
    ]
  },
  "entities": [],
  "dialog": {
    "prompt": "Where",
    "parameterName": "Location",
    "parameterType": "Location",
    "contextId": "3b0725f4-7d6f-43fd-ab6e-02fc11c3eed1",
    "status": "Question"
  }
}

我原以为会得到类似我的第一反应的东西。我是做错了什么还是只是误解了 forceSet 参数应该做什么?

4

0 回答 0