From de1bfdd13693e07ca142e20f5efe1b66ceb9df87 Mon Sep 17 00:00:00 2001 From: Seth <18116602+sethkor@users.noreply.github.com> Date: Wed, 16 Sep 2020 19:13:55 +1000 Subject: [PATCH] Fix and test json monobot example --- README.md | 3 +- examples/json/bots/OrderFlowersBot.json | 56 ++++---- examples/json/intents/AskTime.json | 26 ++-- examples/json/intents/OrderFlowers.json | 152 ++++++++++---------- examples/json/monobot/OrderFlowersMono.json | 10 ++ examples/json/slots/FlowerTypes.json | 34 ++--- 6 files changed, 149 insertions(+), 132 deletions(-) create mode 100644 examples/json/monobot/OrderFlowersMono.json diff --git a/README.md b/README.md index 6d8bd61..45e6e0d 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Commands: Adds or updates an intent put-bot --name=NAME [] - Adds or updates a bot + Adds or updates a bo provision [] Provisions and builds an entire Lex bot including slots, intents and the actual bot @@ -79,7 +79,6 @@ The yaml/json syntax for slots, intents and bots are all based directly of the A supported by the AWS API will be supported in the API now or in the future can be included in a yaml file ###TODO -* Test monobot in json format * Publishing bots * Any other feature requested. * Windows Testing \ No newline at end of file diff --git a/examples/json/bots/OrderFlowersBot.json b/examples/json/bots/OrderFlowersBot.json index 9855ef5..1be3bd2 100644 --- a/examples/json/bots/OrderFlowersBot.json +++ b/examples/json/bots/OrderFlowersBot.json @@ -1,31 +1,33 @@ { - "intents": [ - { - "intentVersion": "$LATEST", - "intentName": "OrderFlowers" - } - ], - "name": "OrderFlowersBot", - "locale": "en-US", - "abortStatement": { - "messages": [ + "lexBot" : { + "intents": [ { - "content": "Sorry, I'm not able to assist at this time", - "contentType": "PlainText" + "intentVersion": "$LATEST", + "intentName": "OrderFlowers" } - ] - }, - "clarificationPrompt": { - "maxAttempts": 2, - "messages": [ - { - "content": "I didn't understand you, what would you like to do?", - "contentType": "PlainText" - } - ] - }, - "voiceId": "Salli", - "childDirected": false, - "idleSessionTTLInSeconds": 600, - "description": "Bot to order flowers on the behalf of a user" + ], + "name": "OrderFlowersBot", + "locale": "en-US", + "abortStatement": { + "messages": [ + { + "content": "Sorry, I'm not able to assist at this time", + "contentType": "PlainText" + } + ] + }, + "clarificationPrompt": { + "maxAttempts": 2, + "messages": [ + { + "content": "I didn't understand you, what would you like to do?", + "contentType": "PlainText" + } + ] + }, + "voiceId": "Salli", + "childDirected": false, + "idleSessionTTLInSeconds": 600, + "description": "Bot to order flowers on the behalf of a user" + } } \ No newline at end of file diff --git a/examples/json/intents/AskTime.json b/examples/json/intents/AskTime.json index a9180b6..53a22f2 100644 --- a/examples/json/intents/AskTime.json +++ b/examples/json/intents/AskTime.json @@ -1,19 +1,21 @@ { - "name": "AskTime", - "description": "Intent to ask what the time is", - "version": "1", - "sampleUtterances": [ + "lexIntent" : { + "name": "AskTime", + "description": "Intent to ask what the time is", + "version": "1", + "sampleUtterances": [ "Whats the time", "What time is it", "Time please", "Time" - ], - "slots": [], - "fulfillmentActivity": { - "codeHook": { - "uri": "arn:aws:lambda:us-west-2:166330533654:function:LexLambdaSampleFulfilment", - "messageVersion": "1.0" - }, - "type": "CodeHook" + ], + "slots": [], + "fulfillmentActivity": { + "codeHook": { + "uri": "arn:aws:lambda:ap-southeast-2:293499315857:function:LexLambdaSampleFulfilment", + "messageVersion": "1.0" + }, + "type": "CodeHook" + } } } \ No newline at end of file diff --git a/examples/json/intents/OrderFlowers.json b/examples/json/intents/OrderFlowers.json index 9efc585..543a2a2 100644 --- a/examples/json/intents/OrderFlowers.json +++ b/examples/json/intents/OrderFlowers.json @@ -1,82 +1,84 @@ { - "name": "OrderFlowers", - "description": "Intent to order a bouquet of flowers for pick up", - "sampleUtterances": [ - "I would like to pick up flowers", - "I would like to order some flowers" - ], - "slots": [ - { - "slotType": "FlowerTypes", - "name": "FlowerType", - "slotConstraint": "Required", - "valueElicitationPrompt": { - "maxAttempts": 2, - "messages": [ - { - "content": "What type of flowers would you like to order?", - "contentType": "PlainText" - } - ] - }, - "priority": 1, - "slotTypeVersion": "$LATEST", - "sampleUtterances": [ - "I would like to order {FlowerType}" - ], - "description": "The type of flowers to pick up" - }, - { - "slotType": "AMAZON.DATE", - "name": "PickupDate", - "slotConstraint": "Required", - "valueElicitationPrompt": { - "maxAttempts": 2, - "messages": [ - { - "content": "What day do you want the {FlowerType} to be picked up?", - "contentType": "PlainText" - } - ] - }, - "priority": 2, - "description": "The date to pick up the flowers" - }, - { - "slotType": "AMAZON.TIME", - "name": "PickupTime", - "slotConstraint": "Required", - "valueElicitationPrompt": { - "maxAttempts": 2, - "messages": [ - { - "content": "Pick up the {FlowerType} at what time on {PickupDate}?", - "contentType": "PlainText" - } - ] + "lexIntent" : { + "name": "OrderFlowers", + "description": "Intent to order a bouquet of flowers for pick up", + "sampleUtterances": [ + "I would like to pick up flowers", + "I would like to order some flowers" + ], + "slots": [ + { + "slotType": "FlowerTypes", + "name": "FlowerType", + "slotConstraint": "Required", + "valueElicitationPrompt": { + "maxAttempts": 2, + "messages": [ + { + "content": "What type of flowers would you like to order?", + "contentType": "PlainText" + } + ] + }, + "priority": 1, + "slotTypeVersion": "$LATEST", + "sampleUtterances": [ + "I would like to order {FlowerType}" + ], + "description": "The type of flowers to pick up" }, - "priority": 3, - "description": "The time to pick up the flowers" - } - ], - "confirmationPrompt": { - "maxAttempts": 2, - "messages": [ { - "content": "Okay, your {FlowerType} will be ready for pickup by {PickupTime} on {PickupDate}. Does this sound okay?", - "contentType": "PlainText" - } - ] - }, - "rejectionStatement": { - "messages": [ + "slotType": "AMAZON.DATE", + "name": "PickupDate", + "slotConstraint": "Required", + "valueElicitationPrompt": { + "maxAttempts": 2, + "messages": [ + { + "content": "What day do you want the {FlowerType} to be picked up?", + "contentType": "PlainText" + } + ] + }, + "priority": 2, + "description": "The date to pick up the flowers" + }, { - "content": "Okay, I will not place your order.", - "contentType": "PlainText" + "slotType": "AMAZON.TIME", + "name": "PickupTime", + "slotConstraint": "Required", + "valueElicitationPrompt": { + "maxAttempts": 2, + "messages": [ + { + "content": "Pick up the {FlowerType} at what time on {PickupDate}?", + "contentType": "PlainText" + } + ] + }, + "priority": 3, + "description": "The time to pick up the flowers" } - ] - }, - "fulfillmentActivity": { - "type": "ReturnIntent" + ], + "confirmationPrompt": { + "maxAttempts": 2, + "messages": [ + { + "content": "Okay, your {FlowerType} will be ready for pickup by {PickupTime} on {PickupDate}. Does this sound okay?", + "contentType": "PlainText" + } + ] + }, + "rejectionStatement": { + "messages": [ + { + "content": "Okay, I will not place your order.", + "contentType": "PlainText" + } + ] + }, + "fulfillmentActivity": { + "type": "ReturnIntent" + } } } \ No newline at end of file diff --git a/examples/json/monobot/OrderFlowersMono.json b/examples/json/monobot/OrderFlowersMono.json new file mode 100644 index 0000000..4858686 --- /dev/null +++ b/examples/json/monobot/OrderFlowersMono.json @@ -0,0 +1,10 @@ +{ + "LexBotProvisioner": { + "lexBotName": "OrderFlowersOnceMore", + "lexBot": "OrderFlowersBot.json", + "lexIntent": "OrderFlowers.json", + "lexSlot": [ + "FlowerTypes.json" + ] + } +} \ No newline at end of file diff --git a/examples/json/slots/FlowerTypes.json b/examples/json/slots/FlowerTypes.json index ec6fb07..b051246 100644 --- a/examples/json/slots/FlowerTypes.json +++ b/examples/json/slots/FlowerTypes.json @@ -1,19 +1,21 @@ { - "name": "FlowerTypes", - "description": "Types of flowers to pick up", - "enumerationValues": [ - { - "value": "tulips" - }, - { - "value": "lilies" - }, - { - "value": "roses" - }, - { - "value": "carnations" - } - ] + "lexSlot" : { + "name": "FlowerTypes", + "description": "Types of flowers to pick up", + "enumerationValues": [ + { + "value": "tulips" + }, + { + "value": "lilies" + }, + { + "value": "roses" + }, + { + "value": "carnations" + } + ] + } } \ No newline at end of file