Amazon Lex V2 を使用している場合は、代わりに Amazon Lex V2 ガイドを参照してください。
Amazon Lex V1 を使用している場合は、ボットを Amazon Lex V2 にアップグレードすることをお勧めします。V1 には新機能を追加されませんので、すべての新しいボットには V2 を使用することを強くお勧めします。
翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
ステップ 3: インテントを作成する (AWS CLI)
OrderFlowersBot
ボットのインテントを作成し、3 つのスロット (パラメータ) を指定します。スロットを使用することで、ボットはインテントを達成できます。
-
FlowerType
は、注文できる花の種類を指定するカスタムスロットタイプです。 -
AMAZON.DATE
およびAMAZON.TIME
は、花の配送日時をユーザーから取得するための組み込みスロットタイプです。
この演習のコマンドを実行するには、コマンドが実行されるリージョンを確認しておく必要があります。リージョンのリストについては、「 モデル構築のクォータ 」を参照してください。
OrderFlowers
インテントを作成するには (AWS CLI)
-
OrderFlowers.json
という名前のテキストファイルを作成します。このテキストファイル内に OrderFlowers.json の JSON コードをコピーします。 -
AWS CLI で、PutIntent オペレーションを呼び出してインテントを作成します。例は、Unix、Linux、および macOS 用にフォーマットされています。Windows の場合は、各行末のバックスラッシュ (\) Unix 連結文字をキャレット (^) に置き換えてください。
aws lex-models put-intent \ --region
region
\ --name OrderFlowers \ --cli-input-json file://OrderFlowers.jsonサーバーは以下のように応答します。
{ "confirmationPrompt": { "maxAttempts": 2, "messages": [ { "content": "Okay, your {FlowerType} will be ready for pickup by {PickupTime} on {PickupDate}. Does this sound okay?", "contentType": "PlainText" } ] }, "name": "OrderFlowers", "checksum": "
checksum
", "version": "$LATEST", "rejectionStatement": { "messages": [ { "content": "Okay, I will not place your order.", "contentType": "PlainText" } ] }, "createdDate":timestamp
, "lastUpdatedDate":timestamp
, "sampleUtterances": [ "I would like to pick up flowers", "I would like to order some flowers" ], "slots": [ { "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" }, { "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" } ], "fulfillmentActivity": { "type": "ReturnIntent" }, "description": "Intent to order a bouquet of flowers for pick up" }