错误代码:InvalidIntentSamplePhraseSlot -

2024-06-19

我收到错误代码Error code: InvalidIntentSamplePhraseSlot当我使用新的技能控制台构建模型时。 完整的错误消息是

Sample utterance "AddBookmarkIntent i am at {pageno} of {mybook}" in intent "AddBookmarkIntent" cannot include both a phrase slot and another intent slot. Error code: InvalidIntentSamplePhraseSlot - 

where {pageno} is AMAZON.NUMBER and {mybook} is AMAZON.SearchQuery

错误是什么以及如何解决?

edit:添加意图的 JSON

{
    "name": "AddBookmarkIntent",
    "slots": [
        {
            "name": "mybook",
            "type": "AMAZON.SearchQuery"
        },
        {
            "name": "pageno",
            "type": "AMAZON.NUMBER"
        }
    ],
    "samples": [
        "i am at {pageno} of the book {mybook}",
        "save page {pageno} to the book {mybook}",
        "save page {pageno} to {mybook}",
        "i am at {pageno} of {mybook}"
    ]
}

不允许有该类型的槽AMAZON.SearchQuery在相同的发声与另一个插槽,在你的情况下AMAZON.NUMBER.

根据需要标记其中一个插槽并单独索取。

一个小例子:

创建放入话语和槽中的 Intent:

"intents": [
    {
      "name": "AddBookmarkIntent",
      "samples": [
        "I am at {pageno}"
      ],
      "slots": [
        {
          "name": "mybook",
          "type": "AMAZON.SearchQuery",
          "samples": [
            "For {mybook}"
          ]
        },
        {
          "name": "pageno",
          "type": "AMAZON.NUMBER"
        }
      ]
    }

根据需要标记特定插槽,以便 Alexa 会自动请求:

"dialog": {
  "intents": [
    {
      "name": "AddBookmarkIntent",
      "confirmationRequired": false,
      "prompts": {},
      "slots": [
        {
          "name": "mybook",
          "type": "AMAZON.SearchQuery",
          "elicitationRequired": true,
          "confirmationRequired": false,
          "prompts": {
            "elicitation": "Elicit.Intent-AddBookmarkIntent.IntentSlot-mybook"
          }
        }
      ]
    }
  ]
}

并创建询问插槽的提示:

"prompts": [
  {
    "id": "Elicit.Intent-AddBookmarkIntent.IntentSlot-mybook",
    "variations": [
      {
        "type": "PlainText",
        "value": "For which book you like to save the page?"
      }
    ]
  }
]

使用技能生成器 BETA(而不是其编辑器)可能会更容易,因为它会在后台自动创建 JSON。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

错误代码:InvalidIntentSamplePhraseSlot - 的相关文章

随机推荐