问题描述
我在使用新技能控制台构建模型时收到错误代码 Error code: InvalidIntentSamplePhraseSlot
.完整的错误信息是
I got the error code Error code: InvalidIntentSamplePhraseSlot
when I built the model using the new skills console.The full error message is
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 -
其中 {pageno}
是 AMAZON.NUMBER
而 {mybook}
是 AMAZON.SearchQuery
where {pageno}
is AMAZON.NUMBER
and {mybook}
is AMAZON.SearchQuery
错误是什么,我该如何解决?
What is the error about and how can I solve it?
edit:为意图添加 JSON
edit: add the JSON for the intent
{
"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
类型的 slot 不允许与另一个 Utterance 类型相同插槽,在您的情况下 AMAZON.NUMBER
.
It's not allowed to have a slot of the type AMAZON.SearchQuery
in the same Utterance with another slot, in your case AMAZON.NUMBER
.
根据需要标记其中一个插槽并单独询问.
Mark one of the slots as required and ask for them separately.
一个小例子:
创建放入话语和槽位的 Intent:
Create the Intent put in the utterances and slots:
"intents": [
{
"name": "AddBookmarkIntent",
"samples": [
"I am at {pageno}"
],
"slots": [
{
"name": "mybook",
"type": "AMAZON.SearchQuery",
"samples": [
"For {mybook}"
]
},
{
"name": "pageno",
"type": "AMAZON.NUMBER"
}
]
}
根据需要标记特定插槽,以便 Alexa 自动请求它:
Mark the specific slot as required so Alexa will automatically ask for it:
"dialog": {
"intents": [
{
"name": "AddBookmarkIntent",
"confirmationRequired": false,
"prompts": {},
"slots": [
{
"name": "mybook",
"type": "AMAZON.SearchQuery",
"elicitationRequired": true,
"confirmationRequired": false,
"prompts": {
"elicitation": "Elicit.Intent-AddBookmarkIntent.IntentSlot-mybook"
}
}
]
}
]
}
并创建请求插槽的提示:
and create the prompts to ask for the slot:
"prompts": [
{
"id": "Elicit.Intent-AddBookmarkIntent.IntentSlot-mybook",
"variations": [
{
"type": "PlainText",
"value": "For which book you like to save the page?"
}
]
}
]
使用 Skill Builder BETA 而不是它的编辑器,这可能要容易得多,因为它会在后台自动创建 JSON.
This is probably much easier with the skill builder BETA and not its editor because it will automatically create the JSON in the background.
这篇关于错误代码:InvalidIntentSamplePhraseSlot -的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!