Put Intent
lexmodelbuildingservice_put_intent | R Documentation |
Creates an intent or replaces an existing intent¶
Description¶
Creates an intent or replaces an existing intent.
To define the interaction between the user and your bot, you use one or
more intents. For a pizza ordering bot, for example, you would create an
OrderPizza
intent.
To create an intent or replace an existing intent, you must provide the following:
-
Intent name. For example,
OrderPizza
. -
Sample utterances. For example, "Can I order a pizza, please." and "I want to order a pizza."
-
Information to be gathered. You specify slot types for the information that your bot will request from the user. You can specify standard slot types, such as a date or a time, or custom slot types such as the size and crust of a pizza.
-
How the intent will be fulfilled. You can provide a Lambda function or configure the intent to return the intent information to the client application. If you use a Lambda function, when all of the intent information is available, Amazon Lex invokes your Lambda function. If you configure your intent to return the intent information to the client application.
You can specify other optional information in the request, such as:
-
A confirmation prompt to ask the user to confirm an intent. For example, "Shall I order your pizza?"
-
A conclusion statement to send to the user after the intent has been fulfilled. For example, "I placed your pizza order."
-
A follow-up prompt that asks the user for additional activity. For example, asking "Do you want to order a drink with your pizza?"
If you specify an existing intent name to update the intent, Amazon Lex
replaces the values in the $LATEST
version of the intent with the
values in the request. Amazon Lex removes fields that you don't provide
in the request. If you don't specify the required fields, Amazon Lex
throws an exception. When you update the $LATEST
version of an intent,
the status
field of any bot that uses the $LATEST
version of the
intent is set to NOT_BUILT
.
For more information, see how-it-works.
This operation requires permissions for the lex:PutIntent
action.
Usage¶
lexmodelbuildingservice_put_intent(name, description, slots,
sampleUtterances, confirmationPrompt, rejectionStatement,
followUpPrompt, conclusionStatement, dialogCodeHook,
fulfillmentActivity, parentIntentSignature, checksum, createVersion,
kendraConfiguration, inputContexts, outputContexts)
Arguments¶
name |
[required] The name of the intent. The name is not case sensitive. The name can't match a built-in intent name, or a built-in intent
name with "AMAZON." removed. For example, because there is a built-in
intent called For a list of built-in intents, see Standard Built-in Intents in the Alexa Skills Kit. |
description |
A description of the intent. |
slots |
An array of intent slots. At runtime, Amazon Lex elicits required slot values from the user using prompts defined in the slots. For more information, see how-it-works. |
sampleUtterances |
An array of utterances (strings) that a user might say to signal the intent. For example, "I want {PizzaSize} pizza", "Order {Quantity} {PizzaSize} pizzas". In each utterance, a slot name is enclosed in curly braces. |
confirmationPrompt |
Prompts the user to confirm the intent. This question should have a yes or no answer. Amazon Lex uses this prompt to ensure that the user acknowledges that
the intent is ready for fulfillment. For example, with the
You you must provide both the |
rejectionStatement |
When the user answers "no" to the question defined in
You must provide both the |
followUpPrompt |
Amazon Lex uses this prompt to solicit additional activity after
fulfilling an intent. For example, after the The action that Amazon Lex takes depends on the user's response, as follows:
The |
conclusionStatement |
The statement that you want Amazon Lex to convey to the user after the intent is successfully fulfilled by the Lambda function. This element is relevant only if you provide a Lambda function in the
The |
dialogCodeHook |
Specifies a Lambda function to invoke for each user input. You can invoke this Lambda function to personalize user interaction. For example, suppose your bot determines that the user is John. Your
Lambda function might retrieve John's information from a backend
database and prepopulate some of the values. For example, if you find
that John is gluten intolerant, you might set the corresponding intent
slot, |
fulfillmentActivity |
Required. Describes how the intent is fulfilled. For example,
after a user provides all of the information for a pizza order,
You might configure Amazon Lex to return all of the intent information to the client application, or direct it to invoke a Lambda function that can process the intent (for example, place an order with a pizzeria). |
parentIntentSignature |
A unique identifier for the built-in intent to base this intent on. To find the signature for an intent, see Standard Built-in Intents in the Alexa Skills Kit. |
checksum |
Identifies a specific revision of the When you create a new intent, leave the When you want to update a intent, set the |
createVersion |
When set to |
kendraConfiguration |
Configuration information required to use the
|
inputContexts |
An array of |
outputContexts |
An array of |
Value¶
A list with the following syntax:
list(
name = "string",
description = "string",
slots = list(
list(
name = "string",
description = "string",
slotConstraint = "Required"|"Optional",
slotType = "string",
slotTypeVersion = "string",
valueElicitationPrompt = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
maxAttempts = 123,
responseCard = "string"
),
priority = 123,
sampleUtterances = list(
"string"
),
responseCard = "string",
obfuscationSetting = "NONE"|"DEFAULT_OBFUSCATION",
defaultValueSpec = list(
defaultValueList = list(
list(
defaultValue = "string"
)
)
)
)
),
sampleUtterances = list(
"string"
),
confirmationPrompt = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
maxAttempts = 123,
responseCard = "string"
),
rejectionStatement = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
responseCard = "string"
),
followUpPrompt = list(
prompt = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
maxAttempts = 123,
responseCard = "string"
),
rejectionStatement = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
responseCard = "string"
)
),
conclusionStatement = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
responseCard = "string"
),
dialogCodeHook = list(
uri = "string",
messageVersion = "string"
),
fulfillmentActivity = list(
type = "ReturnIntent"|"CodeHook",
codeHook = list(
uri = "string",
messageVersion = "string"
)
),
parentIntentSignature = "string",
lastUpdatedDate = as.POSIXct(
"2015-01-01"
),
createdDate = as.POSIXct(
"2015-01-01"
),
version = "string",
checksum = "string",
createVersion = TRUE|FALSE,
kendraConfiguration = list(
kendraIndex = "string",
queryFilterString = "string",
role = "string"
),
inputContexts = list(
list(
name = "string"
)
),
outputContexts = list(
list(
name = "string",
timeToLiveInSeconds = 123,
turnsToLive = 123
)
)
)
Request syntax¶
svc$put_intent(
name = "string",
description = "string",
slots = list(
list(
name = "string",
description = "string",
slotConstraint = "Required"|"Optional",
slotType = "string",
slotTypeVersion = "string",
valueElicitationPrompt = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
maxAttempts = 123,
responseCard = "string"
),
priority = 123,
sampleUtterances = list(
"string"
),
responseCard = "string",
obfuscationSetting = "NONE"|"DEFAULT_OBFUSCATION",
defaultValueSpec = list(
defaultValueList = list(
list(
defaultValue = "string"
)
)
)
)
),
sampleUtterances = list(
"string"
),
confirmationPrompt = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
maxAttempts = 123,
responseCard = "string"
),
rejectionStatement = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
responseCard = "string"
),
followUpPrompt = list(
prompt = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
maxAttempts = 123,
responseCard = "string"
),
rejectionStatement = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
responseCard = "string"
)
),
conclusionStatement = list(
messages = list(
list(
contentType = "PlainText"|"SSML"|"CustomPayload",
content = "string",
groupNumber = 123
)
),
responseCard = "string"
),
dialogCodeHook = list(
uri = "string",
messageVersion = "string"
),
fulfillmentActivity = list(
type = "ReturnIntent"|"CodeHook",
codeHook = list(
uri = "string",
messageVersion = "string"
)
),
parentIntentSignature = "string",
checksum = "string",
createVersion = TRUE|FALSE,
kendraConfiguration = list(
kendraIndex = "string",
queryFilterString = "string",
role = "string"
),
inputContexts = list(
list(
name = "string"
)
),
outputContexts = list(
list(
name = "string",
timeToLiveInSeconds = 123,
turnsToLive = 123
)
)
)
Examples¶
## Not run:
# This example shows how to create an intent for ordering pizzas.
svc$put_intent(
name = "DocOrderPizza",
conclusionStatement = list(
messages = list(
list(
content = "All right, I ordered you a {Crust} crust {Type} pizza with {Sauce} sauce.",
contentType = "PlainText"
),
list(
content = "OK, your {Crust} crust {Type} pizza with {Sauce} sauce is on the way.",
contentType = "PlainText"
)
),
responseCard = "foo"
),
confirmationPrompt = list(
maxAttempts = 1L,
messages = list(
list(
content = "Should I order your {Crust} crust {Type} pizza with {Sauce} sauce?",
contentType = "PlainText"
)
)
),
description = "Order a pizza from a local pizzeria.",
fulfillmentActivity = list(
type = "ReturnIntent"
),
rejectionStatement = list(
messages = list(
list(
content = "Ok, I'll cancel your order.",
contentType = "PlainText"
),
list(
content = "I cancelled your order.",
contentType = "PlainText"
)
)
),
sampleUtterances = list(
"Order me a pizza.",
"Order me a {Type} pizza.",
"I want a {Crust} crust {Type} pizza",
"I want a {Crust} crust {Type} pizza with {Sauce} sauce."
),
slots = list(
list(
name = "Type",
description = "The type of pizza to order.",
priority = 1L,
sampleUtterances = list(
"Get me a {Type} pizza.",
"A {Type} pizza please.",
"I'd like a {Type} pizza."
),
slotConstraint = "Required",
slotType = "DocPizzaType",
slotTypeVersion = "$LATEST",
valueElicitationPrompt = list(
maxAttempts = 1L,
messages = list(
list(
content = "What type of pizza would you like?",
contentType = "PlainText"
),
list(
content = "Vegie or cheese pizza?",
contentType = "PlainText"
),
list(
content = "I can get you a vegie or a cheese pizza.",
contentType = "PlainText"
)
)
)
),
list(
name = "Crust",
description = "The type of pizza crust to order.",
priority = 2L,
sampleUtterances = list(
"Make it a {Crust} crust.",
"I'd like a {Crust} crust."
),
slotConstraint = "Required",
slotType = "DocPizzaCrustType",
slotTypeVersion = "$LATEST",
valueElicitationPrompt = list(
maxAttempts = 1L,
messages = list(
list(
content = "What type of crust would you like?",
contentType = "PlainText"
),
list(
content = "Thick or thin crust?",
contentType = "PlainText"
)
)
)
),
list(
name = "Sauce",
description = "The type of sauce to use on the pizza.",
priority = 3L,
sampleUtterances = list(
"Make it {Sauce} sauce.",
"I'd like {Sauce} sauce."
),
slotConstraint = "Required",
slotType = "DocPizzaSauceType",
slotTypeVersion = "$LATEST",
valueElicitationPrompt = list(
maxAttempts = 1L,
messages = list(
list(
content = "White or red sauce?",
contentType = "PlainText"
),
list(
content = "Garlic or tomato sauce?",
contentType = "PlainText"
)
)
)
)
)
)
## End(Not run)