无法反序列化字符串-从Lambda收到无效响应-Python

时间:2019-09-23 12:14:01

标签: python aws-lambda amazon-lex

我正在尝试创建一个Bot,但是一旦响应试图打印在Amazon lex提供的测试Bot上,我就会遇到一些问题。

an error has occurred: Invalid Lambda Response: Received invalid response from Lambda: Can not deserialize instance of java.lang.String out of START_OBJECT token at 
[Source: {
 "sessionAttributes": {
     "name": "GenralQuestionIntent", 
     "slots": {
          "QuestionKey": "ppo"
     }, 
     "confirmationStatus": "None"
 },
 "dialogAction": {
     "type": "Close", 
     "fulfillmentState": "Fulfilled", 
     "message": {
         "contentType": "PlainText", 
         "content": "PPO or Preferred provider organization is a type of health plan with a preferred network of doctors and other healthcare providers"
      }
 }
}; line: 1, column: 65]

这是我编写的要传递的python代码(Aws lambda)

def close(session_attributes, fulfillment_state, message):
    response = {
        "sessionAttributes": session_attributes,
        "dialogAction": {
            "type": "Close",
            "fulfillmentState": fulfillment_state,
            "message": message
        }

    }

    return response
}

如何解决此问题?请帮助我解决这个问题。响应即将来临,但是lex由于某些原因没有选择它。

0 个答案:

没有答案