create_intent
async
¶
create_intent(
intent_name: Name,
bot_id: Id,
bot_version: DraftBotVersion,
locale_id: LocaleId,
*,
config_overrides: Optional[AsyncLexModelsV2ClientConfig] = None,
intent_display_name: Optional[DisplayName] = None,
description: Optional[Description] = None,
parent_intent_signature: Optional[IntentSignature] = None,
sample_utterances: Optional[SampleUtterancesList] = None,
dialog_code_hook: Optional[DialogCodeHookSettings] = None,
fulfillment_code_hook: Optional[FulfillmentCodeHookSettings] = None,
intent_confirmation_setting: Optional[IntentConfirmationSetting] = None,
intent_closing_setting: Optional[IntentClosingSetting] = None,
input_contexts: Optional[InputContextsList] = None,
output_contexts: Optional[OutputContextsList] = None,
kendra_configuration: Optional[KendraConfiguration] = None,
initial_response_setting: Optional[InitialResponseSetting] = None,
qn_a_intent_configuration: Optional[QnAIntentConfiguration] = None,
q_in_connect_intent_configuration: Optional[QInConnectIntentConfiguration] = None,
) -> CreateIntentResponse
Creates an intent.
To define the interaction between the user and your bot, you define one or more intents. For example, for a pizza ordering bot you would create an OrderPizza intent.
When you create an intent, you must provide a name. You can optionally provide the following:
-
Sample utterances. For example, "I want to order a pizza" and "Can I order a pizza." You can't provide utterances for built-in intents.
-
Information to be gathered. You specify slots for the information that you bot requests from the user. You can specify standard slot types, such as date and time, or custom slot types for your application.
-
How the intent is fulfilled. You can provide a Lambda function or configure the intent to return the intent information to your client application. If you use a Lambda function, Amazon Lex invokes the function when all of the intent information is available.
-
A confirmation prompt to send to the user to confirm an intent. For example, "Shall I order your pizza?"
-
A conclusion statement to send to the user after the intent is fulfilled. For example, "I ordered your pizza."
-
A follow-up prompt that asks the user for additional activity. For example, "Do you want a drink with your pizza?"
Parameters:
-
intent_name(Name) –The name of the intent. Intent names must be unique in the locale that contains the intent and cannot match the name of any built-in intent.
-
intent_display_name(Optional[DisplayName], default:None) –A display name for the intent. If configured, This name will be shown to users during Intent Disambiguation instead of the intent name. Display names should be user-friendly, descriptive and match the intent's purpose to improve user experience during disambiguation.
-
description(Optional[Description], default:None) –A description of the intent. Use the description to help identify the intent in lists.
-
parent_intent_signature(Optional[IntentSignature], default:None) –A unique identifier for the built-in intent to base this intent on.
-
sample_utterances(Optional[SampleUtterancesList], default:None) –An array of strings that a user might say to signal the intent. For example, "I want a pizza", or "I want a {PizzaSize} pizza".
In an utterance, slot names are enclosed in curly braces ("{", "}") to indicate where they should be displayed in the utterance shown to the user..
-
dialog_code_hook(Optional[DialogCodeHookSettings], default:None) –Specifies that Amazon Lex invokes the alias Lambda function for each user input. You can invoke this Lambda function to personalize user interaction.
For example, suppose that your bot determines that the user's name is John. You 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,
glutenIntoleranttotrue. You might find John's phone number and set the corresponding session attribute. -
fulfillment_code_hook(Optional[FulfillmentCodeHookSettings], default:None) –Specifies that Amazon Lex invokes the alias Lambda function when the intent is ready for fulfillment. You can invoke this function to complete the bot's transaction with the user.
For example, in a pizza ordering bot, the Lambda function can look up the closest pizza restaurant to the customer's location and then place an order on the customer's behalf.
-
intent_confirmation_setting(Optional[IntentConfirmationSetting], default:None) –Provides prompts that Amazon Lex sends to the user to confirm the completion of an intent. If the user answers "no," the settings contain a statement that is sent to the user to end the intent.
-
intent_closing_setting(Optional[IntentClosingSetting], default:None) –Sets the response that Amazon Lex sends to the user when the intent is closed.
-
input_contexts(Optional[InputContextsList], default:None) –A list of contexts that must be active for this intent to be considered by Amazon Lex.
When an intent has an input context list, Amazon Lex only considers using the intent in an interaction with the user when the specified contexts are included in the active context list for the session. If the contexts are not active, then Amazon Lex will not use the intent.
A context can be automatically activated using the
outputContextsproperty or it can be set at runtime.For example, if there are two intents with different input contexts that respond to the same utterances, only the intent with the active context will respond.
An intent may have up to 5 input contexts. If an intent has multiple input contexts, all of the contexts must be active to consider the intent.
-
output_contexts(Optional[OutputContextsList], default:None) –A lists of contexts that the intent activates when it is fulfilled.
You can use an output context to indicate the intents that Amazon Lex should consider for the next turn of the conversation with a customer.
When you use the
outputContextsListproperty, all of the contexts specified in the list are activated when the intent is fulfilled. You can set up to 10 output contexts. You can also set the number of conversation turns that the context should be active, or the length of time that the context should be active. -
kendra_configuration(Optional[KendraConfiguration], default:None) –Configuration information required to use the
AMAZON.KendraSearchIntentintent to connect to an Amazon Kendra index. TheAMAZON.KendraSearchIntentintent is called when Amazon Lex can't determine another intent to invoke. -
bot_id(Id) –The identifier of the bot associated with this intent.
-
bot_version(DraftBotVersion) –The version of the bot associated with this intent.
-
locale_id(LocaleId) –The identifier of the language and locale where this intent is used. All of the bots, slot types, and slots used by the intent must have the same locale. For more information, see Supported languages.
-
initial_response_setting(Optional[InitialResponseSetting], default:None) –Configuration settings for the response that is sent to the user at the beginning of a conversation, before eliciting slot values.
-
qn_a_intent_configuration(Optional[QnAIntentConfiguration], default:None) –Specifies the configuration of the built-in
Amazon.QnAIntent. TheAMAZON.QnAIntentintent is called when Amazon Lex can't determine another intent to invoke. If you specify this field, you can't specify thekendraConfigurationfield. -
q_in_connect_intent_configuration(Optional[QInConnectIntentConfiguration], default:None) –Qinconnect intent configuration details for the create intent request.
Raises:
-
ConflictException–The action that you tried to perform couldn't be completed because the resource is in a conflicting state. For example, deleting a bot that is in the CREATING state. Try your request again.
-
InternalServerException–The service encountered an unexpected condition. Try your request again.
-
PreconditionFailedException–Your request couldn't be completed because one or more request fields aren't valid. Check the fields in your request and try again.
-
ServiceQuotaExceededException–You have reached a quota for your bot.
-
ThrottlingException–Your request rate is too high. Reduce the frequency of requests.
-
ValidationException–One of the input parameters in your request isn't valid. Check the parameters and try your request again.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_lex_models_v2/_services/async_lex_models_v2.py
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 | |