Chatbot Using Amazon Lex And Lambda Functions (Python)

Publié le: 24 janvier 2020
sur la chaîne: Cobus Greyling
2,844
10

This video will give you an idea on how to create a simple chatbot with Amazon Lex, and connecting it to a Lambda function. the Lambda function is written in Python.

Session Variables can be created in Lambda and passed to Lex. Subsequently these variables can then be extracted during the course of the conversation.

Here is the Python Code:

def lambda_handler(event, context):
entity = event["currentIntent"]["slots"]["Name"].title()
intent = event["currentIntent"]["name"]

response = {

"sessionAttributes": {
"key1": "value1",
"key2": "value2"
},
"dialogAction":
{
"fulfillmentState":"Fulfilled",
"type":"Close",
"message":
{
"contentType":"PlainText",
"content": "The intent you are in now is "+intent+"!"
}
}

}
return response


Sur cette page du site, vous pouvez voir la vidéo en ligne Chatbot Using Amazon Lex And Lambda Functions (Python) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Cobus Greyling 24 janvier 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 2,844 fois et il a aimé 10 téléspectateurs. Bon visionnage!