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
In questa pagina del sito puoi guardare il video online Chatbot Using Amazon Lex And Lambda Functions (Python) della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Cobus Greyling 24 gennaio 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 2,844 volte e gli è piaciuto 10 spettatori. Buona visione!