3

我正在尝试使用亚马逊的boto3库构建一个聊天机器人。现在,我正在尝试使用该put_intent函数创建一个意图。我的代码如下:

intent = lexClient.put_intent(name = 'test',                                 
                              sampleUtterances = ["Who is messi?"]  
                              )

当我尝试运行它时,出现以下异常:

botocore.errorfactory.BadRequestException:调用 PutIntent 操作时发生错误 (BadRequestException):RelativeId 与 Lex ARN 格式不匹配:intent:test2:$LATEST

谁能告诉我我做错了什么?

4

3 回答 3

5

尝试在意图名称字段中输入数字时出现相同的错误。意识到尝试从 AWS 控制台执行相同操作时不允许这样做。

错误处理真的可以更具体。

于 2017-07-21T22:34:47.073 回答
3

试着把问号从话语中去掉,这在过去给我带来了问题!

于 2017-07-13T10:50:02.550 回答
0

You need to run GetSlotType. That will return current checksum for that slot. Put that checksum in your PutSlotType checksum. Big bang boom.

https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/LexModelBuildingService.html#getSlotType-property

var params = { name: "AppointmentTypeValue", checksum:'54c6ab5f-fe30-483a-a364-b76e32f6f05d',

description: "Type of dentist appointment to schedule'",
enumerationValues: [
    {
        value: "cleaning"
    },
    {
        value: "whitening"
    },
    {
        value: "root canal"
    },
    {
        value:"punch my face"
    }
]

};

于 2020-05-13T14:26:13.017 回答