aws-sdk-lexruntimeservice 1.0.0.rc1 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-lexruntimeservice.rb +1 -1
- data/lib/aws-sdk-lexruntimeservice/client.rb +351 -53
- data/lib/aws-sdk-lexruntimeservice/client_api.rb +52 -0
- data/lib/aws-sdk-lexruntimeservice/types.rb +428 -121
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 064ad4c323c89dcdc169a87426b5b0a87476af90
|
4
|
+
data.tar.gz: 71d99d170a6778994ba1f23d73743f4fd27ef39a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c37948a0ce4176aa1168c8c1d2687ca989c6ebb82f61389533cf3e294eaaf3e6843b9bbee3fa6bf30240115824bc51e56c13f3f08bbc85b731b092181e56fb1
|
7
|
+
data.tar.gz: ee5751ca966d595d5162a23671082a93cfd302ec60bec49adb187425322339ad086109105cf9f021637659b4482fac30787d55ed557c1c50994f8c10df0ba49d
|
@@ -18,6 +18,7 @@ require 'aws-sdk-core/plugins/regional_endpoint.rb'
|
|
18
18
|
require 'aws-sdk-core/plugins/response_paging.rb'
|
19
19
|
require 'aws-sdk-core/plugins/stub_responses.rb'
|
20
20
|
require 'aws-sdk-core/plugins/idempotency_token.rb'
|
21
|
+
require 'aws-sdk-core/plugins/jsonvalue_converter.rb'
|
21
22
|
require 'aws-sdk-core/plugins/signature_v4.rb'
|
22
23
|
require 'aws-sdk-core/plugins/protocols/rest_json.rb'
|
23
24
|
|
@@ -45,6 +46,7 @@ module Aws::LexRuntimeService
|
|
45
46
|
add_plugin(Aws::Plugins::ResponsePaging)
|
46
47
|
add_plugin(Aws::Plugins::StubResponses)
|
47
48
|
add_plugin(Aws::Plugins::IdempotencyToken)
|
49
|
+
add_plugin(Aws::Plugins::JsonvalueConverter)
|
48
50
|
add_plugin(Aws::Plugins::SignatureV4)
|
49
51
|
add_plugin(Aws::Plugins::Protocols::RestJson)
|
50
52
|
|
@@ -143,29 +145,63 @@ module Aws::LexRuntimeService
|
|
143
145
|
|
144
146
|
# @!group API Operations
|
145
147
|
|
146
|
-
# Sends user input text to Amazon Lex
|
147
|
-
#
|
148
|
-
#
|
148
|
+
# Sends user input (text or speech) to Amazon Lex. Clients use this API
|
149
|
+
# to send requests to Amazon Lex at runtime. Amazon Lex interprets the
|
150
|
+
# user input using the machine learning model that it built for the bot.
|
149
151
|
#
|
150
|
-
# In response, Amazon Lex returns the next message to convey to the
|
151
|
-
#
|
152
|
-
# user response to the message (`dialogState`). For example, consider
|
153
|
-
# the following response messages:
|
152
|
+
# In response, Amazon Lex returns the next message to convey to the
|
153
|
+
# user. Consider the following example messages:
|
154
154
|
#
|
155
|
-
# *
|
156
|
-
#
|
157
|
-
#
|
155
|
+
# * For a user input "I would like a pizza," Amazon Lex might return a
|
156
|
+
# response with a message eliciting slot data (for example,
|
157
|
+
# `PizzaSize`): "What size pizza would you like?".
|
158
158
|
#
|
159
|
-
# *
|
160
|
-
#
|
161
|
-
#
|
162
|
-
# `CreateIntent`):
|
159
|
+
# * After the user provides all of the pizza order information, Amazon
|
160
|
+
# Lex might return a response with a message to get user confirmation:
|
161
|
+
# "Order the pizza?".
|
163
162
|
#
|
164
|
-
#
|
165
|
-
#
|
163
|
+
# * After the user replies "Yes" to the confirmation prompt, Amazon
|
164
|
+
# Lex might return a conclusion statement: "Thank you, your cheese
|
165
|
+
# pizza has been ordered.".
|
166
166
|
#
|
167
|
-
#
|
168
|
-
#
|
167
|
+
# Not all Amazon Lex messages require a response from the user. For
|
168
|
+
# example, conclusion statements do not require a response. Some
|
169
|
+
# messages require only a yes or no response. In addition to the
|
170
|
+
# `message`, Amazon Lex provides additional context about the message in
|
171
|
+
# the response that you can use to enhance client behavior, such as
|
172
|
+
# displaying the appropriate client user interface. Consider the
|
173
|
+
# following examples:
|
174
|
+
#
|
175
|
+
# * If the message is to elicit slot data, Amazon Lex returns the
|
176
|
+
# following context information:
|
177
|
+
#
|
178
|
+
# * `x-amz-lex-dialog-state` header set to `ElicitSlot`
|
179
|
+
#
|
180
|
+
# * `x-amz-lex-intent-name` header set to the intent name in the
|
181
|
+
# current context
|
182
|
+
#
|
183
|
+
# * `x-amz-lex-slot-to-elicit` header set to the slot name for which
|
184
|
+
# the `message` is eliciting information
|
185
|
+
#
|
186
|
+
# * `x-amz-lex-slots` header set to a map of slots configured for the
|
187
|
+
# intent with their current values
|
188
|
+
#
|
189
|
+
# * If the message is a confirmation prompt, the
|
190
|
+
# `x-amz-lex-dialog-state` header is set to `Confirmation` and the
|
191
|
+
# `x-amz-lex-slot-to-elicit` header is omitted.
|
192
|
+
#
|
193
|
+
# * If the message is a clarification prompt configured for the intent,
|
194
|
+
# indicating that the user intent is not understood, the
|
195
|
+
# `x-amz-dialog-state` header is set to `ElicitIntent` and the
|
196
|
+
# `x-amz-slot-to-elicit` header is omitted.
|
197
|
+
#
|
198
|
+
# In addition, Amazon Lex also returns your application-specific
|
199
|
+
# `sessionAttributes`. For more information, see [Managing Conversation
|
200
|
+
# Context][1].
|
201
|
+
#
|
202
|
+
#
|
203
|
+
#
|
204
|
+
# [1]: http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html
|
169
205
|
#
|
170
206
|
# @option params [required, String] :bot_name
|
171
207
|
# Name of the Amazon Lex bot.
|
@@ -174,11 +210,255 @@ module Aws::LexRuntimeService
|
|
174
210
|
# Alias of the Amazon Lex bot.
|
175
211
|
#
|
176
212
|
# @option params [required, String] :user_id
|
177
|
-
#
|
178
|
-
#
|
179
|
-
#
|
213
|
+
# ID of the client application user. Typically, each of your application
|
214
|
+
# users should have a unique ID. The application developer decides the
|
215
|
+
# user IDs. At runtime, each request must include the user ID. Note the
|
216
|
+
# following considerations:
|
217
|
+
#
|
218
|
+
# * If you want a user to start conversation on one device and continue
|
219
|
+
# the conversation on another device, you might choose a user-specific
|
220
|
+
# identifier, such as the user's login, or Amazon Cognito user ID
|
221
|
+
# (assuming your application is using Amazon Cognito).
|
222
|
+
#
|
223
|
+
# * If you want the same user to be able to have two independent
|
224
|
+
# conversations on two different devices, you might choose
|
225
|
+
# device-specific identifier, such as device ID, or some globally
|
226
|
+
# unique identifier.
|
227
|
+
#
|
228
|
+
# @option params [String] :session_attributes
|
229
|
+
# You pass this value in the `x-amz-lex-session-attributes` HTTP header.
|
230
|
+
# The value must be map (keys and values must be strings) that is JSON
|
231
|
+
# serialized and then base64 encoded.
|
232
|
+
#
|
233
|
+
# A session represents dialog between a user and Amazon Lex. At runtime,
|
234
|
+
# a client application can pass contextual information, in the request
|
235
|
+
# to Amazon Lex. For example,
|
236
|
+
#
|
237
|
+
# * You might use session attributes to track the requestID of user
|
238
|
+
# requests.
|
239
|
+
#
|
240
|
+
# * In Getting Started Exercise 1, the example bot uses the price
|
241
|
+
# session attribute to maintain the price of flowers ordered (for
|
242
|
+
# example, "price":25). The code hook (Lambda function) sets this
|
243
|
+
# attribute based on the type of flowers ordered. For more
|
244
|
+
# information, see [Review the Details of Information Flow][1].
|
245
|
+
#
|
246
|
+
# * In the BookTrip bot exercise, the bot uses the `currentReservation`
|
247
|
+
# session attribute to maintains the slot data during the in-progress
|
248
|
+
# conversation to book a hotel or book a car. For more information,
|
249
|
+
# see [Details of Information Flow][2].
|
250
|
+
#
|
251
|
+
# Amazon Lex passes these session attributes to the Lambda functions
|
252
|
+
# configured for the intent In the your Lambda function, you can use the
|
253
|
+
# session attributes for initialization and customization (prompts).
|
254
|
+
# Some examples are:
|
255
|
+
#
|
256
|
+
# * Initialization - In a pizza ordering bot, if you pass user location
|
257
|
+
# (for example, `"Location : 111 Maple Street"`), then your Lambda
|
258
|
+
# function might use this information to determine the closest
|
259
|
+
# pizzeria to place the order (and perhaps set the storeAddress slot
|
260
|
+
# value as well).
|
261
|
+
#
|
262
|
+
# Personalized prompts - For example, you can configure prompts to
|
263
|
+
# refer to the user by name (for example, "Hey \[firstName\], what
|
264
|
+
# toppings would you like?"). You can pass the user's name as a
|
265
|
+
# session attribute ("firstName": "Joe") so that Amazon Lex can
|
266
|
+
# substitute the placeholder to provide a personalized prompt to the
|
267
|
+
# user ("Hey Joe, what toppings would you like?").
|
268
|
+
#
|
269
|
+
# <note markdown="1"> Amazon Lex does not persist session attributes.
|
270
|
+
#
|
271
|
+
# If you configured a code hook for the intent, Amazon Lex passes the
|
272
|
+
# incoming session attributes to the Lambda function. The Lambda
|
273
|
+
# function must return these session attributes if you want Amazon Lex
|
274
|
+
# to return them to the client.
|
275
|
+
#
|
276
|
+
# If there is no code hook configured for the intent Amazon Lex simply
|
277
|
+
# returns the session attributes to the client application.
|
278
|
+
#
|
279
|
+
# </note>
|
280
|
+
#
|
281
|
+
# **SDK automatically handles json encoding and base64 encoding for you
|
282
|
+
# when the required value (Hash, Array, etc.) is provided according to
|
283
|
+
# the description.**
|
284
|
+
#
|
285
|
+
#
|
286
|
+
#
|
287
|
+
# [1]: http://docs.aws.amazon.com/lex/latest/dg/gs-bp-details-after-lambda.html
|
288
|
+
# [2]: http://docs.aws.amazon.com/lex/latest/dg/book-trip-detail-flow.html
|
289
|
+
#
|
290
|
+
# @option params [required, String] :content_type
|
291
|
+
# You pass this values as the `Content-Type` HTTP header.
|
292
|
+
#
|
293
|
+
# Indicates the audio format or text. The header value must start with
|
294
|
+
# one of the following prefixes:
|
295
|
+
#
|
296
|
+
# * PCM format
|
297
|
+
#
|
298
|
+
# * audio/l16; rate=16000; channels=1
|
299
|
+
#
|
300
|
+
# * audio/x-l16; sample-rate=16000; channel-count=1
|
301
|
+
#
|
302
|
+
# * Opus format
|
303
|
+
#
|
304
|
+
# * audio/x-cbr-opus-with-preamble; preamble-size=0; bit-rate=1;
|
305
|
+
# frame-size-milliseconds=1.1
|
306
|
+
#
|
307
|
+
# ^
|
308
|
+
#
|
309
|
+
# * Text format
|
310
|
+
#
|
311
|
+
# * text/plain; charset=utf-8
|
312
|
+
#
|
313
|
+
# ^
|
314
|
+
#
|
315
|
+
# @option params [String] :accept
|
316
|
+
# You pass this value as the `Accept` HTTP header.
|
317
|
+
#
|
318
|
+
# The message Amazon Lex returns in the response can be either text or
|
319
|
+
# speech based on the `Accept` HTTP header value in the request.
|
320
|
+
#
|
321
|
+
# * If the value is `text/plain; charset=utf-8`, Amazon Lex returns text
|
322
|
+
# in the response.
|
323
|
+
#
|
324
|
+
# * If the value begins with `audio/`, Amazon Lex returns speech in the
|
325
|
+
# response. Amazon Lex uses Amazon Polly to generate the speech (using
|
326
|
+
# the configuration you specified in the `Accept` header). For
|
327
|
+
# example, if you specify `audio/mpeg` as the value, Amazon Lex
|
328
|
+
# returns speech in the MPEG format.
|
329
|
+
#
|
330
|
+
# The following are the accepted values:
|
331
|
+
#
|
332
|
+
# * audio/mpeg
|
333
|
+
#
|
334
|
+
# * audio/ogg
|
335
|
+
#
|
336
|
+
# * audio/pcm
|
337
|
+
#
|
338
|
+
# * text/plain; charset=utf-8
|
339
|
+
#
|
340
|
+
# * audio/* (defaults to mpeg)
|
341
|
+
#
|
342
|
+
# @option params [required, String, IO] :input_stream
|
343
|
+
# User input in PCM or Opus audio format or text format as described in
|
344
|
+
# the `Content-Type` HTTP header.
|
345
|
+
#
|
346
|
+
# @return [Types::PostContentResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
347
|
+
#
|
348
|
+
# * {Types::PostContentResponse#content_type #content_type} => String
|
349
|
+
# * {Types::PostContentResponse#intent_name #intent_name} => String
|
350
|
+
# * {Types::PostContentResponse#slots #slots} => String
|
351
|
+
# * {Types::PostContentResponse#session_attributes #session_attributes} => String
|
352
|
+
# * {Types::PostContentResponse#message #message} => String
|
353
|
+
# * {Types::PostContentResponse#dialog_state #dialog_state} => String
|
354
|
+
# * {Types::PostContentResponse#slot_to_elicit #slot_to_elicit} => String
|
355
|
+
# * {Types::PostContentResponse#input_transcript #input_transcript} => String
|
356
|
+
# * {Types::PostContentResponse#audio_stream #audio_stream} => IO
|
357
|
+
#
|
358
|
+
# @example Request syntax with placeholder values
|
359
|
+
#
|
360
|
+
# resp = client.post_content({
|
361
|
+
# bot_name: "BotName", # required
|
362
|
+
# bot_alias: "BotAlias", # required
|
363
|
+
# user_id: "UserId", # required
|
364
|
+
# session_attributes: "String",
|
365
|
+
# content_type: "HttpContentType", # required
|
366
|
+
# accept: "Accept",
|
367
|
+
# input_stream: "data", # required
|
368
|
+
# })
|
369
|
+
#
|
370
|
+
# @example Response structure
|
371
|
+
#
|
372
|
+
# resp.content_type #=> String
|
373
|
+
# resp.intent_name #=> String
|
374
|
+
# resp.slots #=> String
|
375
|
+
# resp.session_attributes #=> String
|
376
|
+
# resp.message #=> String
|
377
|
+
# resp.dialog_state #=> String, one of "ElicitIntent", "ConfirmIntent", "ElicitSlot", "Fulfilled", "ReadyForFulfillment", "Failed"
|
378
|
+
# resp.slot_to_elicit #=> String
|
379
|
+
# resp.input_transcript #=> String
|
380
|
+
# resp.audio_stream #=> IO
|
381
|
+
#
|
382
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostContent AWS API Documentation
|
383
|
+
#
|
384
|
+
# @overload post_content(params = {})
|
385
|
+
# @param [Hash] params ({})
|
386
|
+
def post_content(params = {}, options = {})
|
387
|
+
req = build_request(:post_content, params)
|
388
|
+
req.send_request(options)
|
389
|
+
end
|
390
|
+
|
391
|
+
# Sends user input (text-only) to Amazon Lex. Client applications can
|
392
|
+
# use this API to send requests to Amazon Lex at runtime. Amazon Lex
|
393
|
+
# then interprets the user input using the machine learning model it
|
394
|
+
# built for the bot.
|
395
|
+
#
|
396
|
+
# In response, Amazon Lex returns the next `message` to convey to the
|
397
|
+
# user an optional `responseCard` to display. Consider the following
|
398
|
+
# example messages:
|
399
|
+
#
|
400
|
+
# * For a user input "I would like a pizza", Amazon Lex might return a
|
401
|
+
# response with a message eliciting slot data (for example,
|
402
|
+
# PizzaSize): "What size pizza would you like?"
|
403
|
+
#
|
404
|
+
# * After the user provides all of the pizza order information, Amazon
|
405
|
+
# Lex might return a response with a message to obtain user
|
406
|
+
# confirmation "Proceed with the pizza order?".
|
407
|
+
#
|
408
|
+
# * After the user replies to a confirmation prompt with a "yes",
|
409
|
+
# Amazon Lex might return a conclusion statement: "Thank you, your
|
410
|
+
# cheese pizza has been ordered.".
|
411
|
+
#
|
412
|
+
# Not all Amazon Lex messages require a user response. For example, a
|
413
|
+
# conclusion statement does not require a response. Some messages
|
414
|
+
# require only a "yes" or "no" user response. In addition to the
|
415
|
+
# `message`, Amazon Lex provides additional context about the message in
|
416
|
+
# the response that you might use to enhance client behavior, for
|
417
|
+
# example, to display the appropriate client user interface. These are
|
418
|
+
# the `slotToElicit`, `dialogState`, `intentName`, and `slots` fields in
|
419
|
+
# the response. Consider the following examples:
|
420
|
+
#
|
421
|
+
# * If the message is to elicit slot data, Amazon Lex returns the
|
422
|
+
# following context information:
|
423
|
+
#
|
424
|
+
# * `dialogState` set to ElicitSlot
|
425
|
+
#
|
426
|
+
# * `intentName` set to the intent name in the current context
|
427
|
+
#
|
428
|
+
# * `slotToElicit` set to the slot name for which the `message` is
|
429
|
+
# eliciting information
|
430
|
+
#
|
431
|
+
# * `slots` set to a map of slots, configured for the intent, with
|
432
|
+
# currently known values
|
433
|
+
#
|
434
|
+
# * If the message is a confirmation prompt, the `dialogState` is set to
|
435
|
+
# ConfirmIntent and `SlotToElicit` is set to null.
|
436
|
+
#
|
437
|
+
# * If the message is a clarification prompt (configured for the intent)
|
438
|
+
# that indicates that user intent is not understood, the `dialogState`
|
439
|
+
# is set to ElicitIntent and `slotToElicit` is set to null.
|
440
|
+
#
|
441
|
+
# In addition, Amazon Lex also returns your application-specific
|
442
|
+
# `sessionAttributes`. For more information, see [Managing Conversation
|
443
|
+
# Context][1].
|
444
|
+
#
|
445
|
+
#
|
446
|
+
#
|
447
|
+
# [1]: http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html
|
448
|
+
#
|
449
|
+
# @option params [required, String] :bot_name
|
450
|
+
# The name of the Amazon Lex bot.
|
451
|
+
#
|
452
|
+
# @option params [required, String] :bot_alias
|
453
|
+
# The alias of the Amazon Lex bot.
|
454
|
+
#
|
455
|
+
# @option params [required, String] :user_id
|
456
|
+
# The ID of the client application user. The application developer
|
457
|
+
# decides the user IDs. At runtime, each request must include the user
|
458
|
+
# ID. Typically, each of your application users should have a unique ID.
|
459
|
+
# Note the following considerations:
|
180
460
|
#
|
181
|
-
# * If you want a user to start a conversation on one
|
461
|
+
# * If you want a user to start a conversation on one device and
|
182
462
|
# continue the conversation on another device, you might choose a
|
183
463
|
# user-specific identifier, such as a login or Amazon Cognito user ID
|
184
464
|
# (assuming your application is using Amazon Cognito).
|
@@ -189,44 +469,62 @@ module Aws::LexRuntimeService
|
|
189
469
|
# unique identifier.
|
190
470
|
#
|
191
471
|
# @option params [Hash<String,String>] :session_attributes
|
192
|
-
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
-
#
|
197
|
-
#
|
198
|
-
#
|
199
|
-
#
|
200
|
-
#
|
201
|
-
#
|
202
|
-
#
|
203
|
-
#
|
204
|
-
#
|
205
|
-
#
|
206
|
-
#
|
207
|
-
#
|
208
|
-
#
|
209
|
-
#
|
210
|
-
#
|
211
|
-
#
|
212
|
-
#
|
472
|
+
# By using session attributes, a client application can pass contextual
|
473
|
+
# information in the request to Amazon Lex For example,
|
474
|
+
#
|
475
|
+
# * In Getting Started Exercise 1, the example bot uses the `price`
|
476
|
+
# session attribute to maintain the price of the flowers ordered (for
|
477
|
+
# example, "Price":25). The code hook (the Lambda function) sets
|
478
|
+
# this attribute based on the type of flowers ordered. For more
|
479
|
+
# information, see [Review the Details of Information Flow][1].
|
480
|
+
#
|
481
|
+
# * In the BookTrip bot exercise, the bot uses the `currentReservation`
|
482
|
+
# session attribute to maintain slot data during the in-progress
|
483
|
+
# conversation to book a hotel or book a car. For more information,
|
484
|
+
# see [Details of Information Flow][2].
|
485
|
+
#
|
486
|
+
# * You might use the session attributes (key, value pairs) to track the
|
487
|
+
# requestID of user requests.
|
488
|
+
#
|
489
|
+
# Amazon Lex simply passes these session attributes to the Lambda
|
490
|
+
# functions configured for the intent.
|
491
|
+
#
|
492
|
+
# In your Lambda function, you can also use the session attributes for
|
493
|
+
# initialization and customization (prompts and response cards). Some
|
494
|
+
# examples are:
|
495
|
+
#
|
496
|
+
# * Initialization - In a pizza ordering bot, if you can pass the user
|
497
|
+
# location as a session attribute (for example, `"Location" : "111
|
498
|
+
# Maple street"`), then your Lambda function might use this
|
499
|
+
# information to determine the closest pizzeria to place the order
|
500
|
+
# (perhaps to set the storeAddress slot value).
|
501
|
+
#
|
502
|
+
# * Personalize prompts - For example, you can configure prompts to
|
503
|
+
# refer to the user name. (For example, "Hey \[FirstName\], what
|
504
|
+
# toppings would you like?"). You can pass the user name as a session
|
505
|
+
# attribute (`"FirstName" : "Joe"`) so that Amazon Lex can substitute
|
506
|
+
# the placeholder to provide a personalize prompt to the user ("Hey
|
507
|
+
# Joe, what toppings would you like?").
|
213
508
|
#
|
214
509
|
# <note markdown="1"> Amazon Lex does not persist session attributes.
|
215
510
|
#
|
216
|
-
# If
|
217
|
-
#
|
218
|
-
# Lex
|
219
|
-
#
|
511
|
+
# If you configure a code hook for the intent, Amazon Lex passes the
|
512
|
+
# incoming session attributes to the Lambda function. If you want Amazon
|
513
|
+
# Lex to return these session attributes back to the client, the Lambda
|
514
|
+
# function must return them.
|
220
515
|
#
|
221
|
-
# If
|
222
|
-
#
|
223
|
-
# Lambda function. The Lambda function must return these session
|
224
|
-
# attributes if you want Amazon Lex to return them back to the client.
|
516
|
+
# If there is no code hook configured for the intent, Amazon Lex simply
|
517
|
+
# returns the session attributes back to the client application.
|
225
518
|
#
|
226
519
|
# </note>
|
227
520
|
#
|
521
|
+
#
|
522
|
+
#
|
523
|
+
# [1]: http://docs.aws.amazon.com/lex/latest/dg/gs-bp-details-after-lambda.html
|
524
|
+
# [2]: http://docs.aws.amazon.com/lex/latest/dg/book-trip-detail-flow.html
|
525
|
+
#
|
228
526
|
# @option params [required, String] :input_text
|
229
|
-
#
|
527
|
+
# The text that the user entered (Amazon Lex interprets this text).
|
230
528
|
#
|
231
529
|
# @return [Types::PostTextResponse] Returns a {Seahorse::Client::Response response} object which responds to the following methods:
|
232
530
|
#
|
@@ -293,7 +591,7 @@ module Aws::LexRuntimeService
|
|
293
591
|
params: params,
|
294
592
|
config: config)
|
295
593
|
context[:gem_name] = 'aws-sdk-lexruntimeservice'
|
296
|
-
context[:gem_version] = '1.0.0.
|
594
|
+
context[:gem_version] = '1.0.0.rc2'
|
297
595
|
Seahorse::Client::Request.new(handlers, context)
|
298
596
|
end
|
299
597
|
|
@@ -11,8 +11,10 @@ module Aws::LexRuntimeService
|
|
11
11
|
|
12
12
|
include Seahorse::Model
|
13
13
|
|
14
|
+
Accept = Shapes::StringShape.new(name: 'Accept')
|
14
15
|
BadGatewayException = Shapes::StructureShape.new(name: 'BadGatewayException')
|
15
16
|
BadRequestException = Shapes::StructureShape.new(name: 'BadRequestException')
|
17
|
+
BlobStream = Shapes::BlobShape.new(name: 'BlobStream')
|
16
18
|
BotAlias = Shapes::StringShape.new(name: 'BotAlias')
|
17
19
|
BotName = Shapes::StringShape.new(name: 'BotName')
|
18
20
|
Button = Shapes::StructureShape.new(name: 'Button')
|
@@ -24,19 +26,25 @@ module Aws::LexRuntimeService
|
|
24
26
|
DialogState = Shapes::StringShape.new(name: 'DialogState')
|
25
27
|
ErrorMessage = Shapes::StringShape.new(name: 'ErrorMessage')
|
26
28
|
GenericAttachment = Shapes::StructureShape.new(name: 'GenericAttachment')
|
29
|
+
HttpContentType = Shapes::StringShape.new(name: 'HttpContentType')
|
27
30
|
IntentName = Shapes::StringShape.new(name: 'IntentName')
|
28
31
|
InternalFailureException = Shapes::StructureShape.new(name: 'InternalFailureException')
|
29
32
|
LimitExceededException = Shapes::StructureShape.new(name: 'LimitExceededException')
|
30
33
|
LoopDetectedException = Shapes::StructureShape.new(name: 'LoopDetectedException')
|
34
|
+
NotAcceptableException = Shapes::StructureShape.new(name: 'NotAcceptableException')
|
31
35
|
NotFoundException = Shapes::StructureShape.new(name: 'NotFoundException')
|
36
|
+
PostContentRequest = Shapes::StructureShape.new(name: 'PostContentRequest')
|
37
|
+
PostContentResponse = Shapes::StructureShape.new(name: 'PostContentResponse')
|
32
38
|
PostTextRequest = Shapes::StructureShape.new(name: 'PostTextRequest')
|
33
39
|
PostTextResponse = Shapes::StructureShape.new(name: 'PostTextResponse')
|
40
|
+
RequestTimeoutException = Shapes::StructureShape.new(name: 'RequestTimeoutException')
|
34
41
|
ResponseCard = Shapes::StructureShape.new(name: 'ResponseCard')
|
35
42
|
String = Shapes::StringShape.new(name: 'String')
|
36
43
|
StringMap = Shapes::MapShape.new(name: 'StringMap')
|
37
44
|
StringUrlWithLength = Shapes::StringShape.new(name: 'StringUrlWithLength')
|
38
45
|
StringWithLength = Shapes::StringShape.new(name: 'StringWithLength')
|
39
46
|
Text = Shapes::StringShape.new(name: 'Text')
|
47
|
+
UnsupportedMediaTypeException = Shapes::StructureShape.new(name: 'UnsupportedMediaTypeException')
|
40
48
|
UserId = Shapes::StringShape.new(name: 'UserId')
|
41
49
|
genericAttachmentList = Shapes::ListShape.new(name: 'genericAttachmentList')
|
42
50
|
listOfButtons = Shapes::ListShape.new(name: 'listOfButtons')
|
@@ -52,6 +60,30 @@ module Aws::LexRuntimeService
|
|
52
60
|
GenericAttachment.add_member(:buttons, Shapes::ShapeRef.new(shape: listOfButtons, location_name: "buttons"))
|
53
61
|
GenericAttachment.struct_class = Types::GenericAttachment
|
54
62
|
|
63
|
+
PostContentRequest.add_member(:bot_name, Shapes::ShapeRef.new(shape: BotName, required: true, location: "uri", location_name: "botName"))
|
64
|
+
PostContentRequest.add_member(:bot_alias, Shapes::ShapeRef.new(shape: BotAlias, required: true, location: "uri", location_name: "botAlias"))
|
65
|
+
PostContentRequest.add_member(:user_id, Shapes::ShapeRef.new(shape: UserId, required: true, location: "uri", location_name: "userId"))
|
66
|
+
PostContentRequest.add_member(:session_attributes, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "x-amz-lex-session-attributes", metadata: {"jsonvalue"=>true}))
|
67
|
+
PostContentRequest.add_member(:content_type, Shapes::ShapeRef.new(shape: HttpContentType, required: true, location: "header", location_name: "Content-Type"))
|
68
|
+
PostContentRequest.add_member(:accept, Shapes::ShapeRef.new(shape: Accept, location: "header", location_name: "Accept"))
|
69
|
+
PostContentRequest.add_member(:input_stream, Shapes::ShapeRef.new(shape: BlobStream, required: true, location_name: "inputStream"))
|
70
|
+
PostContentRequest.struct_class = Types::PostContentRequest
|
71
|
+
PostContentRequest[:payload] = :input_stream
|
72
|
+
PostContentRequest[:payload_member] = PostContentRequest.member(:input_stream)
|
73
|
+
|
74
|
+
PostContentResponse.add_member(:content_type, Shapes::ShapeRef.new(shape: HttpContentType, location: "header", location_name: "Content-Type"))
|
75
|
+
PostContentResponse.add_member(:intent_name, Shapes::ShapeRef.new(shape: IntentName, location: "header", location_name: "x-amz-lex-intent-name"))
|
76
|
+
PostContentResponse.add_member(:slots, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "x-amz-lex-slots", metadata: {"jsonvalue"=>true}))
|
77
|
+
PostContentResponse.add_member(:session_attributes, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "x-amz-lex-session-attributes", metadata: {"jsonvalue"=>true}))
|
78
|
+
PostContentResponse.add_member(:message, Shapes::ShapeRef.new(shape: Text, location: "header", location_name: "x-amz-lex-message"))
|
79
|
+
PostContentResponse.add_member(:dialog_state, Shapes::ShapeRef.new(shape: DialogState, location: "header", location_name: "x-amz-lex-dialog-state"))
|
80
|
+
PostContentResponse.add_member(:slot_to_elicit, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "x-amz-lex-slot-to-elicit"))
|
81
|
+
PostContentResponse.add_member(:input_transcript, Shapes::ShapeRef.new(shape: String, location: "header", location_name: "x-amz-lex-input-transcript"))
|
82
|
+
PostContentResponse.add_member(:audio_stream, Shapes::ShapeRef.new(shape: BlobStream, location_name: "audioStream"))
|
83
|
+
PostContentResponse.struct_class = Types::PostContentResponse
|
84
|
+
PostContentResponse[:payload] = :audio_stream
|
85
|
+
PostContentResponse[:payload_member] = PostContentResponse.member(:audio_stream)
|
86
|
+
|
55
87
|
PostTextRequest.add_member(:bot_name, Shapes::ShapeRef.new(shape: BotName, required: true, location: "uri", location_name: "botName"))
|
56
88
|
PostTextRequest.add_member(:bot_alias, Shapes::ShapeRef.new(shape: BotAlias, required: true, location: "uri", location_name: "botAlias"))
|
57
89
|
PostTextRequest.add_member(:user_id, Shapes::ShapeRef.new(shape: UserId, required: true, location: "uri", location_name: "userId"))
|
@@ -95,6 +127,26 @@ module Aws::LexRuntimeService
|
|
95
127
|
"signingName" => "lex",
|
96
128
|
}
|
97
129
|
|
130
|
+
api.add_operation(:post_content, Seahorse::Model::Operation.new.tap do |o|
|
131
|
+
o.name = "PostContent"
|
132
|
+
o.http_method = "POST"
|
133
|
+
o.http_request_uri = "/bot/{botName}/alias/{botAlias}/user/{userId}/content"
|
134
|
+
o['authtype'] = "v4-unsigned-body"
|
135
|
+
o.input = Shapes::ShapeRef.new(shape: PostContentRequest)
|
136
|
+
o.output = Shapes::ShapeRef.new(shape: PostContentResponse)
|
137
|
+
o.errors << Shapes::ShapeRef.new(shape: NotFoundException)
|
138
|
+
o.errors << Shapes::ShapeRef.new(shape: BadRequestException)
|
139
|
+
o.errors << Shapes::ShapeRef.new(shape: LimitExceededException)
|
140
|
+
o.errors << Shapes::ShapeRef.new(shape: InternalFailureException)
|
141
|
+
o.errors << Shapes::ShapeRef.new(shape: ConflictException)
|
142
|
+
o.errors << Shapes::ShapeRef.new(shape: UnsupportedMediaTypeException)
|
143
|
+
o.errors << Shapes::ShapeRef.new(shape: NotAcceptableException)
|
144
|
+
o.errors << Shapes::ShapeRef.new(shape: RequestTimeoutException)
|
145
|
+
o.errors << Shapes::ShapeRef.new(shape: DependencyFailedException)
|
146
|
+
o.errors << Shapes::ShapeRef.new(shape: BadGatewayException)
|
147
|
+
o.errors << Shapes::ShapeRef.new(shape: LoopDetectedException)
|
148
|
+
end)
|
149
|
+
|
98
150
|
api.add_operation(:post_text, Seahorse::Model::Operation.new.tap do |o|
|
99
151
|
o.name = "PostText"
|
100
152
|
o.http_method = "POST"
|
@@ -12,13 +12,13 @@ module Aws::LexRuntimeService
|
|
12
12
|
# Slack, etc.)
|
13
13
|
#
|
14
14
|
# @!attribute [rw] text
|
15
|
-
# Text visible to the user on the button.
|
15
|
+
# Text that is visible to the user on the button.
|
16
16
|
# @return [String]
|
17
17
|
#
|
18
18
|
# @!attribute [rw] value
|
19
|
-
#
|
20
|
-
# consider button text "NYC"
|
21
|
-
# value sent can be "New York City"
|
19
|
+
# The value sent to Amazon Lex when a user chooses the button. For
|
20
|
+
# example, consider button text "NYC." When the user chooses the
|
21
|
+
# button, the value sent can be "New York City."
|
22
22
|
# @return [String]
|
23
23
|
#
|
24
24
|
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/Button AWS API Documentation
|
@@ -33,22 +33,23 @@ module Aws::LexRuntimeService
|
|
33
33
|
# could be an image, a button, a link, or text.
|
34
34
|
#
|
35
35
|
# @!attribute [rw] title
|
36
|
-
#
|
36
|
+
# The title of the option.
|
37
37
|
# @return [String]
|
38
38
|
#
|
39
39
|
# @!attribute [rw] sub_title
|
40
|
-
#
|
40
|
+
# The subtitle shown below the title.
|
41
41
|
# @return [String]
|
42
42
|
#
|
43
43
|
# @!attribute [rw] attachment_link_url
|
44
|
+
# The URL of an attachment to the response card.
|
44
45
|
# @return [String]
|
45
46
|
#
|
46
47
|
# @!attribute [rw] image_url
|
47
|
-
# URL of an image that is displayed to the user.
|
48
|
+
# The URL of an image that is displayed to the user.
|
48
49
|
# @return [String]
|
49
50
|
#
|
50
51
|
# @!attribute [rw] buttons
|
51
|
-
#
|
52
|
+
# The list of options to show to the user.
|
52
53
|
# @return [Array<Types::Button>]
|
53
54
|
#
|
54
55
|
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/GenericAttachment AWS API Documentation
|
@@ -62,6 +63,294 @@ module Aws::LexRuntimeService
|
|
62
63
|
include Aws::Structure
|
63
64
|
end
|
64
65
|
|
66
|
+
# @note When making an API call, you may pass PostContentRequest
|
67
|
+
# data as a hash:
|
68
|
+
#
|
69
|
+
# {
|
70
|
+
# bot_name: "BotName", # required
|
71
|
+
# bot_alias: "BotAlias", # required
|
72
|
+
# user_id: "UserId", # required
|
73
|
+
# session_attributes: "String",
|
74
|
+
# content_type: "HttpContentType", # required
|
75
|
+
# accept: "Accept",
|
76
|
+
# input_stream: "data", # required
|
77
|
+
# }
|
78
|
+
#
|
79
|
+
# @!attribute [rw] bot_name
|
80
|
+
# Name of the Amazon Lex bot.
|
81
|
+
# @return [String]
|
82
|
+
#
|
83
|
+
# @!attribute [rw] bot_alias
|
84
|
+
# Alias of the Amazon Lex bot.
|
85
|
+
# @return [String]
|
86
|
+
#
|
87
|
+
# @!attribute [rw] user_id
|
88
|
+
# ID of the client application user. Typically, each of your
|
89
|
+
# application users should have a unique ID. The application developer
|
90
|
+
# decides the user IDs. At runtime, each request must include the user
|
91
|
+
# ID. Note the following considerations:
|
92
|
+
#
|
93
|
+
# * If you want a user to start conversation on one device and
|
94
|
+
# continue the conversation on another device, you might choose a
|
95
|
+
# user-specific identifier, such as the user's login, or Amazon
|
96
|
+
# Cognito user ID (assuming your application is using Amazon
|
97
|
+
# Cognito).
|
98
|
+
#
|
99
|
+
# * If you want the same user to be able to have two independent
|
100
|
+
# conversations on two different devices, you might choose
|
101
|
+
# device-specific identifier, such as device ID, or some globally
|
102
|
+
# unique identifier.
|
103
|
+
# @return [String]
|
104
|
+
#
|
105
|
+
# @!attribute [rw] session_attributes
|
106
|
+
# You pass this value in the `x-amz-lex-session-attributes` HTTP
|
107
|
+
# header. The value must be map (keys and values must be strings) that
|
108
|
+
# is JSON serialized and then base64 encoded.
|
109
|
+
#
|
110
|
+
# A session represents dialog between a user and Amazon Lex. At
|
111
|
+
# runtime, a client application can pass contextual information, in
|
112
|
+
# the request to Amazon Lex. For example,
|
113
|
+
#
|
114
|
+
# * You might use session attributes to track the requestID of user
|
115
|
+
# requests.
|
116
|
+
#
|
117
|
+
# * In Getting Started Exercise 1, the example bot uses the price
|
118
|
+
# session attribute to maintain the price of flowers ordered (for
|
119
|
+
# example, "price":25). The code hook (Lambda function) sets this
|
120
|
+
# attribute based on the type of flowers ordered. For more
|
121
|
+
# information, see [Review the Details of Information Flow][1].
|
122
|
+
#
|
123
|
+
# * In the BookTrip bot exercise, the bot uses the
|
124
|
+
# `currentReservation` session attribute to maintains the slot data
|
125
|
+
# during the in-progress conversation to book a hotel or book a car.
|
126
|
+
# For more information, see [Details of Information Flow][2].
|
127
|
+
#
|
128
|
+
# Amazon Lex passes these session attributes to the Lambda functions
|
129
|
+
# configured for the intent In the your Lambda function, you can use
|
130
|
+
# the session attributes for initialization and customization
|
131
|
+
# (prompts). Some examples are:
|
132
|
+
#
|
133
|
+
# * Initialization - In a pizza ordering bot, if you pass user
|
134
|
+
# location (for example, `"Location : 111 Maple Street"`), then your
|
135
|
+
# Lambda function might use this information to determine the
|
136
|
+
# closest pizzeria to place the order (and perhaps set the
|
137
|
+
# storeAddress slot value as well).
|
138
|
+
#
|
139
|
+
# Personalized prompts - For example, you can configure prompts to
|
140
|
+
# refer to the user by name (for example, "Hey \[firstName\], what
|
141
|
+
# toppings would you like?"). You can pass the user's name as a
|
142
|
+
# session attribute ("firstName": "Joe") so that Amazon Lex can
|
143
|
+
# substitute the placeholder to provide a personalized prompt to the
|
144
|
+
# user ("Hey Joe, what toppings would you like?").
|
145
|
+
#
|
146
|
+
# <note markdown="1"> Amazon Lex does not persist session attributes.
|
147
|
+
#
|
148
|
+
# If you configured a code hook for the intent, Amazon Lex passes the
|
149
|
+
# incoming session attributes to the Lambda function. The Lambda
|
150
|
+
# function must return these session attributes if you want Amazon Lex
|
151
|
+
# to return them to the client.
|
152
|
+
#
|
153
|
+
# If there is no code hook configured for the intent Amazon Lex simply
|
154
|
+
# returns the session attributes to the client application.
|
155
|
+
#
|
156
|
+
# </note>
|
157
|
+
#
|
158
|
+
#
|
159
|
+
#
|
160
|
+
# [1]: http://docs.aws.amazon.com/lex/latest/dg/gs-bp-details-after-lambda.html
|
161
|
+
# [2]: http://docs.aws.amazon.com/lex/latest/dg/book-trip-detail-flow.html
|
162
|
+
# @return [String]
|
163
|
+
#
|
164
|
+
# @!attribute [rw] content_type
|
165
|
+
# You pass this values as the `Content-Type` HTTP header.
|
166
|
+
#
|
167
|
+
# Indicates the audio format or text. The header value must start with
|
168
|
+
# one of the following prefixes:
|
169
|
+
#
|
170
|
+
# * PCM format
|
171
|
+
#
|
172
|
+
# * audio/l16; rate=16000; channels=1
|
173
|
+
#
|
174
|
+
# * audio/x-l16; sample-rate=16000; channel-count=1
|
175
|
+
#
|
176
|
+
# * Opus format
|
177
|
+
#
|
178
|
+
# * audio/x-cbr-opus-with-preamble; preamble-size=0; bit-rate=1;
|
179
|
+
# frame-size-milliseconds=1.1
|
180
|
+
#
|
181
|
+
# ^
|
182
|
+
#
|
183
|
+
# * Text format
|
184
|
+
#
|
185
|
+
# * text/plain; charset=utf-8
|
186
|
+
#
|
187
|
+
# ^
|
188
|
+
# @return [String]
|
189
|
+
#
|
190
|
+
# @!attribute [rw] accept
|
191
|
+
# You pass this value as the `Accept` HTTP header.
|
192
|
+
#
|
193
|
+
# The message Amazon Lex returns in the response can be either text or
|
194
|
+
# speech based on the `Accept` HTTP header value in the request.
|
195
|
+
#
|
196
|
+
# * If the value is `text/plain; charset=utf-8`, Amazon Lex returns
|
197
|
+
# text in the response.
|
198
|
+
#
|
199
|
+
# * If the value begins with `audio/`, Amazon Lex returns speech in
|
200
|
+
# the response. Amazon Lex uses Amazon Polly to generate the speech
|
201
|
+
# (using the configuration you specified in the `Accept` header).
|
202
|
+
# For example, if you specify `audio/mpeg` as the value, Amazon Lex
|
203
|
+
# returns speech in the MPEG format.
|
204
|
+
#
|
205
|
+
# The following are the accepted values:
|
206
|
+
#
|
207
|
+
# * audio/mpeg
|
208
|
+
#
|
209
|
+
# * audio/ogg
|
210
|
+
#
|
211
|
+
# * audio/pcm
|
212
|
+
#
|
213
|
+
# * text/plain; charset=utf-8
|
214
|
+
#
|
215
|
+
# * audio/* (defaults to mpeg)
|
216
|
+
# @return [String]
|
217
|
+
#
|
218
|
+
# @!attribute [rw] input_stream
|
219
|
+
# User input in PCM or Opus audio format or text format as described
|
220
|
+
# in the `Content-Type` HTTP header.
|
221
|
+
# @return [IO]
|
222
|
+
#
|
223
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostContentRequest AWS API Documentation
|
224
|
+
#
|
225
|
+
class PostContentRequest < Struct.new(
|
226
|
+
:bot_name,
|
227
|
+
:bot_alias,
|
228
|
+
:user_id,
|
229
|
+
:session_attributes,
|
230
|
+
:content_type,
|
231
|
+
:accept,
|
232
|
+
:input_stream)
|
233
|
+
include Aws::Structure
|
234
|
+
end
|
235
|
+
|
236
|
+
# @!attribute [rw] content_type
|
237
|
+
# Content type as specified in the `Accept` HTTP header in the
|
238
|
+
# request.
|
239
|
+
# @return [String]
|
240
|
+
#
|
241
|
+
# @!attribute [rw] intent_name
|
242
|
+
# Current user intent that Amazon Lex is aware of.
|
243
|
+
# @return [String]
|
244
|
+
#
|
245
|
+
# @!attribute [rw] slots
|
246
|
+
# Map of zero or more intent slots (name/value pairs) Amazon Lex
|
247
|
+
# detected from the user input during the conversation.
|
248
|
+
# @return [String]
|
249
|
+
#
|
250
|
+
# @!attribute [rw] session_attributes
|
251
|
+
# Map of key/value pairs representing the session-specific context
|
252
|
+
# information.
|
253
|
+
# @return [String]
|
254
|
+
#
|
255
|
+
# @!attribute [rw] message
|
256
|
+
# Message to convey to the user. It can come from the bot's
|
257
|
+
# configuration or a code hook (Lambda function). If the current
|
258
|
+
# intent is not configured with a code hook or if the code hook
|
259
|
+
# returned `Delegate` as the `dialogAction.type` in its response, then
|
260
|
+
# Amazon Lex decides the next course of action and selects an
|
261
|
+
# appropriate message from the bot configuration based on the current
|
262
|
+
# user interaction context. For example, if Amazon Lex is not able to
|
263
|
+
# understand the user input, it uses a clarification prompt message
|
264
|
+
# (For more information, see the Error Handling section in the Amazon
|
265
|
+
# Lex console). Another example: if the intent requires confirmation
|
266
|
+
# before fulfillment, then Amazon Lex uses the confirmation prompt
|
267
|
+
# message in the intent configuration. If the code hook returns a
|
268
|
+
# message, Amazon Lex passes it as-is in its response to the client.
|
269
|
+
# @return [String]
|
270
|
+
#
|
271
|
+
# @!attribute [rw] dialog_state
|
272
|
+
# Identifies the current state of the user interaction. Amazon Lex
|
273
|
+
# returns one of the following values as `dialogState`. The client can
|
274
|
+
# optionally use this information to customize the user interface.
|
275
|
+
#
|
276
|
+
# * `ElicitIntent` – Amazon Lex wants to elicit the user's intent.
|
277
|
+
# Consider the following examples:
|
278
|
+
#
|
279
|
+
# For example, a user might utter an intent ("I want to order a
|
280
|
+
# pizza"). If Amazon Lex cannot infer the user intent from this
|
281
|
+
# utterance, it will return this dialog state.
|
282
|
+
#
|
283
|
+
# * `ConfirmIntent` – Amazon Lex is expecting a "yes" or "no"
|
284
|
+
# response.
|
285
|
+
#
|
286
|
+
# For example, Amazon Lex wants user confirmation before fulfilling
|
287
|
+
# an intent. Instead of a simple "yes" or "no" response, a user
|
288
|
+
# might respond with additional information. For example, "yes, but
|
289
|
+
# make it a thick crust pizza" or "no, I want to order a drink."
|
290
|
+
# Amazon Lex can process such additional information (in these
|
291
|
+
# examples, update the crust type slot or change the intent from
|
292
|
+
# OrderPizza to OrderDrink).
|
293
|
+
#
|
294
|
+
# * `ElicitSlot` – Amazon Lex is expecting the value of a slot for the
|
295
|
+
# current intent.
|
296
|
+
#
|
297
|
+
# For example, suppose that in the response Amazon Lex sends this
|
298
|
+
# message: "What size pizza would you like?". A user might reply
|
299
|
+
# with the slot value (e.g., "medium"). The user might also
|
300
|
+
# provide additional information in the response (e.g., "medium
|
301
|
+
# thick crust pizza"). Amazon Lex can process such additional
|
302
|
+
# information appropriately.
|
303
|
+
#
|
304
|
+
# * `Fulfilled` – Conveys that the Lambda function has successfully
|
305
|
+
# fulfilled the intent.
|
306
|
+
#
|
307
|
+
# * `ReadyForFulfillment` – Conveys that the client has to fullfill
|
308
|
+
# the request.
|
309
|
+
#
|
310
|
+
# * `Failed` – Conveys that the conversation with the user failed.
|
311
|
+
#
|
312
|
+
# This can happen for various reasons, including that the user does
|
313
|
+
# not provide an appropriate response to prompts from the service
|
314
|
+
# (you can configure how many times Amazon Lex can prompt a user for
|
315
|
+
# specific information), or if the Lambda function fails to fulfill
|
316
|
+
# the intent.
|
317
|
+
# @return [String]
|
318
|
+
#
|
319
|
+
# @!attribute [rw] slot_to_elicit
|
320
|
+
# If the `dialogState` value is `ElicitSlot`, returns the name of the
|
321
|
+
# slot for which Amazon Lex is eliciting a value.
|
322
|
+
# @return [String]
|
323
|
+
#
|
324
|
+
# @!attribute [rw] input_transcript
|
325
|
+
# Transcript of the voice input to the operation.
|
326
|
+
# @return [String]
|
327
|
+
#
|
328
|
+
# @!attribute [rw] audio_stream
|
329
|
+
# The prompt (or statement) to convey to the user. This is based on
|
330
|
+
# the bot configuration and context. For example, if Amazon Lex did
|
331
|
+
# not understand the user intent, it sends the `clarificationPrompt`
|
332
|
+
# configured for the bot. If the intent requires confirmation before
|
333
|
+
# taking the fulfillment action, it sends the `confirmationPrompt`.
|
334
|
+
# Another example: Suppose that the Lambda function successfully
|
335
|
+
# fulfilled the intent, and sent a message to convey to the user. Then
|
336
|
+
# Amazon Lex sends that message in the response.
|
337
|
+
# @return [IO]
|
338
|
+
#
|
339
|
+
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostContentResponse AWS API Documentation
|
340
|
+
#
|
341
|
+
class PostContentResponse < Struct.new(
|
342
|
+
:content_type,
|
343
|
+
:intent_name,
|
344
|
+
:slots,
|
345
|
+
:session_attributes,
|
346
|
+
:message,
|
347
|
+
:dialog_state,
|
348
|
+
:slot_to_elicit,
|
349
|
+
:input_transcript,
|
350
|
+
:audio_stream)
|
351
|
+
include Aws::Structure
|
352
|
+
end
|
353
|
+
|
65
354
|
# @note When making an API call, you may pass PostTextRequest
|
66
355
|
# data as a hash:
|
67
356
|
#
|
@@ -76,21 +365,22 @@ module Aws::LexRuntimeService
|
|
76
365
|
# }
|
77
366
|
#
|
78
367
|
# @!attribute [rw] bot_name
|
79
|
-
#
|
368
|
+
# The name of the Amazon Lex bot.
|
80
369
|
# @return [String]
|
81
370
|
#
|
82
371
|
# @!attribute [rw] bot_alias
|
83
|
-
#
|
372
|
+
# The alias of the Amazon Lex bot.
|
84
373
|
# @return [String]
|
85
374
|
#
|
86
375
|
# @!attribute [rw] user_id
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
376
|
+
# The ID of the client application user. The application developer
|
377
|
+
# decides the user IDs. At runtime, each request must include the user
|
378
|
+
# ID. Typically, each of your application users should have a unique
|
379
|
+
# ID. Note the following considerations:
|
380
|
+
#
|
381
|
+
# * If you want a user to start a conversation on one device and
|
382
|
+
# continue the conversation on another device, you might choose a
|
383
|
+
# user-specific identifier, such as a login or Amazon Cognito user
|
94
384
|
# ID (assuming your application is using Amazon Cognito).
|
95
385
|
#
|
96
386
|
# * If you want the same user to be able to have two independent
|
@@ -100,45 +390,64 @@ module Aws::LexRuntimeService
|
|
100
390
|
# @return [String]
|
101
391
|
#
|
102
392
|
# @!attribute [rw] session_attributes
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
#
|
111
|
-
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
#
|
118
|
-
#
|
119
|
-
#
|
120
|
-
#
|
121
|
-
#
|
122
|
-
#
|
123
|
-
#
|
393
|
+
# By using session attributes, a client application can pass
|
394
|
+
# contextual information in the request to Amazon Lex For example,
|
395
|
+
#
|
396
|
+
# * In Getting Started Exercise 1, the example bot uses the `price`
|
397
|
+
# session attribute to maintain the price of the flowers ordered
|
398
|
+
# (for example, "Price":25). The code hook (the Lambda function)
|
399
|
+
# sets this attribute based on the type of flowers ordered. For more
|
400
|
+
# information, see [Review the Details of Information Flow][1].
|
401
|
+
#
|
402
|
+
# * In the BookTrip bot exercise, the bot uses the
|
403
|
+
# `currentReservation` session attribute to maintain slot data
|
404
|
+
# during the in-progress conversation to book a hotel or book a car.
|
405
|
+
# For more information, see [Details of Information Flow][2].
|
406
|
+
#
|
407
|
+
# * You might use the session attributes (key, value pairs) to track
|
408
|
+
# the requestID of user requests.
|
409
|
+
#
|
410
|
+
# Amazon Lex simply passes these session attributes to the Lambda
|
411
|
+
# functions configured for the intent.
|
412
|
+
#
|
413
|
+
# In your Lambda function, you can also use the session attributes for
|
414
|
+
# initialization and customization (prompts and response cards). Some
|
415
|
+
# examples are:
|
416
|
+
#
|
417
|
+
# * Initialization - In a pizza ordering bot, if you can pass the user
|
418
|
+
# location as a session attribute (for example, `"Location" : "111
|
419
|
+
# Maple street"`), then your Lambda function might use this
|
420
|
+
# information to determine the closest pizzeria to place the order
|
421
|
+
# (perhaps to set the storeAddress slot value).
|
422
|
+
#
|
423
|
+
# * Personalize prompts - For example, you can configure prompts to
|
424
|
+
# refer to the user name. (For example, "Hey \[FirstName\], what
|
425
|
+
# toppings would you like?"). You can pass the user name as a
|
426
|
+
# session attribute (`"FirstName" : "Joe"`) so that Amazon Lex can
|
427
|
+
# substitute the placeholder to provide a personalize prompt to the
|
428
|
+
# user ("Hey Joe, what toppings would you like?").
|
124
429
|
#
|
125
430
|
# <note markdown="1"> Amazon Lex does not persist session attributes.
|
126
431
|
#
|
127
|
-
# If
|
128
|
-
#
|
129
|
-
# Amazon Lex
|
130
|
-
#
|
432
|
+
# If you configure a code hook for the intent, Amazon Lex passes the
|
433
|
+
# incoming session attributes to the Lambda function. If you want
|
434
|
+
# Amazon Lex to return these session attributes back to the client,
|
435
|
+
# the Lambda function must return them.
|
131
436
|
#
|
132
|
-
# If
|
133
|
-
#
|
134
|
-
#
|
135
|
-
# attributes if you want Amazon Lex to return them back to the client.
|
437
|
+
# If there is no code hook configured for the intent, Amazon Lex
|
438
|
+
# simply returns the session attributes back to the client
|
439
|
+
# application.
|
136
440
|
#
|
137
441
|
# </note>
|
442
|
+
#
|
443
|
+
#
|
444
|
+
#
|
445
|
+
# [1]: http://docs.aws.amazon.com/lex/latest/dg/gs-bp-details-after-lambda.html
|
446
|
+
# [2]: http://docs.aws.amazon.com/lex/latest/dg/book-trip-detail-flow.html
|
138
447
|
# @return [Hash<String,String>]
|
139
448
|
#
|
140
449
|
# @!attribute [rw] input_text
|
141
|
-
#
|
450
|
+
# The text that the user entered (Amazon Lex interprets this text).
|
142
451
|
# @return [String]
|
143
452
|
#
|
144
453
|
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostTextRequest AWS API Documentation
|
@@ -153,96 +462,94 @@ module Aws::LexRuntimeService
|
|
153
462
|
end
|
154
463
|
|
155
464
|
# @!attribute [rw] intent_name
|
156
|
-
#
|
157
|
-
# the intents configured for the bot.
|
465
|
+
# The current user intent that Amazon Lex is aware of.
|
158
466
|
# @return [String]
|
159
467
|
#
|
160
468
|
# @!attribute [rw] slots
|
161
|
-
#
|
162
|
-
# user input in the conversation.
|
469
|
+
# The intent slots (name/value pairs) that Amazon Lex detected so far
|
470
|
+
# from the user input in the conversation.
|
163
471
|
# @return [Hash<String,String>]
|
164
472
|
#
|
165
473
|
# @!attribute [rw] session_attributes
|
166
|
-
#
|
474
|
+
# A map of key-value pairs representing the session-specific context
|
167
475
|
# information.
|
168
476
|
# @return [Hash<String,String>]
|
169
477
|
#
|
170
478
|
# @!attribute [rw] message
|
171
|
-
#
|
172
|
-
#
|
173
|
-
#
|
174
|
-
# `
|
175
|
-
#
|
176
|
-
#
|
177
|
-
#
|
178
|
-
#
|
179
|
-
#
|
479
|
+
# A message to convey to the user. It can come from the bot's
|
480
|
+
# configuration or a code hook (Lambda function). If the current
|
481
|
+
# intent is not configured with a code hook or the code hook returned
|
482
|
+
# `Delegate` as the `dialogAction.type` in its response, then Amazon
|
483
|
+
# Lex decides the next course of action and selects an appropriate
|
484
|
+
# message from the bot configuration based on the current user
|
485
|
+
# interaction context. For example, if Amazon Lex is not able to
|
486
|
+
# understand the user input, it uses a clarification prompt message
|
487
|
+
# (for more information, see the Error Handling section in the Amazon
|
488
|
+
# Lex console). Another example: if the intent requires confirmation
|
489
|
+
# before fulfillment, then Amazon Lex uses the confirmation prompt
|
490
|
+
# message in the intent configuration. If the code hook returns a
|
491
|
+
# message, Amazon Lex passes it as-is in its response to the client.
|
180
492
|
# @return [String]
|
181
493
|
#
|
182
494
|
# @!attribute [rw] dialog_state
|
183
|
-
#
|
184
|
-
#
|
185
|
-
#
|
186
|
-
# example, Amazon Lex did not understand the first utterances such
|
187
|
-
# as "I want to order pizza", which indicates the OrderPizza
|
188
|
-
# intent. If Amazon Lex doesn't understand the intent, it returns
|
189
|
-
# this `dialogState`. Another example is when your intent is
|
190
|
-
# configured with a follow up prompt. For example, after OrderPizza
|
191
|
-
# intent is fulfilled, the intent might have a follow up prompt such
|
192
|
-
# as " Do you want to order a drink or desert?" In this case,
|
193
|
-
# Amazon Lex returns this `dialogState`.
|
194
|
-
#
|
195
|
-
# * `ConfirmIntent` – Amazon Lex is expecting a yes/no response from
|
196
|
-
# the user indicating whether to go ahead and fulfill the intent
|
197
|
-
# (for example, OK to go ahead and order the pizza). In addition to
|
198
|
-
# a yes/no reply, the user might provide a response with additional
|
199
|
-
# slot information (either new slot information or changes to the
|
200
|
-
# existing slot values). For example, "Yes, but change to thick
|
201
|
-
# crust." Amazon Lex understands the additional information and
|
202
|
-
# updates the intent slots accordingly.
|
203
|
-
#
|
204
|
-
# Consider another example. Before fulfilling an order, your
|
205
|
-
# application might prompt for confirmation such as "Do you want to
|
206
|
-
# place this pizza order?" A user might reply with "No, I want to
|
207
|
-
# order a drink." Amazon Lex recognizes the new OrderDrink intent.
|
208
|
-
#
|
209
|
-
# * `ElicitSlot` – Amazon Lex is expecting a value of a slot for the
|
210
|
-
# current intent. For example, suppose Amazon Lex asks, "What size
|
211
|
-
# pizza would you like?" A user might reply with "Medium pepperoni
|
212
|
-
# pizza." Amazon Lex recognizes the size and the topping as the two
|
213
|
-
# separate slot values.
|
495
|
+
# Identifies the current state of the user interaction. Amazon Lex
|
496
|
+
# returns one of the following values as `dialogState`. The client can
|
497
|
+
# optionally use this information to customize the user interface.
|
214
498
|
#
|
215
|
-
# * `
|
216
|
-
#
|
217
|
-
#
|
218
|
-
#
|
219
|
-
#
|
220
|
-
#
|
221
|
-
#
|
222
|
-
#
|
223
|
-
#
|
224
|
-
#
|
225
|
-
#
|
226
|
-
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
#
|
230
|
-
#
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
499
|
+
# * `ElicitIntent` – Amazon Lex wants to elicit user intent.
|
500
|
+
#
|
501
|
+
# For example, a user might utter an intent ("I want to order a
|
502
|
+
# pizza"). If Amazon Lex cannot infer the user intent from this
|
503
|
+
# utterance, it will return this dialogState.
|
504
|
+
#
|
505
|
+
# * `ConfirmIntent` – Amazon Lex is expecting a "yes" or "no"
|
506
|
+
# response.
|
507
|
+
#
|
508
|
+
# For example, Amazon Lex wants user confirmation before fulfilling
|
509
|
+
# an intent.
|
510
|
+
#
|
511
|
+
# Instead of a simple "yes" or "no," a user might respond with
|
512
|
+
# additional information. For example, "yes, but make it thick
|
513
|
+
# crust pizza" or "no, I want to order a drink". Amazon Lex can
|
514
|
+
# process such additional information (in these examples, update the
|
515
|
+
# crust type slot value, or change intent from OrderPizza to
|
516
|
+
# OrderDrink).
|
517
|
+
#
|
518
|
+
# * `ElicitSlot` – Amazon Lex is expecting a slot value for the
|
519
|
+
# current intent.
|
520
|
+
#
|
521
|
+
# For example, suppose that in the response Amazon Lex sends this
|
522
|
+
# message: "What size pizza would you like?". A user might reply
|
523
|
+
# with the slot value (e.g., "medium"). The user might also
|
524
|
+
# provide additional information in the response (e.g., "medium
|
525
|
+
# thick crust pizza"). Amazon Lex can process such additional
|
526
|
+
# information appropriately.
|
527
|
+
#
|
528
|
+
# * `Fulfilled` – Conveys that the Lambda function configured for the
|
529
|
+
# intent has successfully fulfilled the intent.
|
530
|
+
#
|
531
|
+
# * `ReadyForFulfillment` – Conveys that the client has to fulfill the
|
532
|
+
# intent.
|
533
|
+
#
|
534
|
+
# * `Failed` – Conveys that the conversation with the user failed.
|
535
|
+
#
|
536
|
+
# This can happen for various reasons including that the user did
|
537
|
+
# not provide an appropriate response to prompts from the service
|
538
|
+
# (you can configure how many times Amazon Lex can prompt a user for
|
539
|
+
# specific information), or the Lambda function failed to fulfill
|
540
|
+
# the intent.
|
235
541
|
# @return [String]
|
236
542
|
#
|
237
543
|
# @!attribute [rw] slot_to_elicit
|
238
|
-
# If `dialogState` value is `ElicitSlot`, returns the name of the
|
239
|
-
# for which Amazon Lex is eliciting a value.
|
544
|
+
# If the `dialogState` value is `ElicitSlot`, returns the name of the
|
545
|
+
# slot for which Amazon Lex is eliciting a value.
|
240
546
|
# @return [String]
|
241
547
|
#
|
242
548
|
# @!attribute [rw] response_card
|
243
549
|
# Represents the options that the user has to respond to the current
|
244
|
-
# prompt.
|
245
|
-
#
|
550
|
+
# prompt. Response Card can come from the bot configuration (in the
|
551
|
+
# Amazon Lex console, choose the settings button next to a slot) or
|
552
|
+
# from a code hook (Lambda function).
|
246
553
|
# @return [Types::ResponseCard]
|
247
554
|
#
|
248
555
|
# @see http://docs.aws.amazon.com/goto/WebAPI/runtime.lex-2016-11-28/PostTextResponse AWS API Documentation
|
@@ -259,16 +566,16 @@ module Aws::LexRuntimeService
|
|
259
566
|
end
|
260
567
|
|
261
568
|
# If you configure a response card when creating your bots, Amazon Lex
|
262
|
-
# substitutes the session attributes and slot values available,
|
263
|
-
# returns it. The response card can also come from a Lambda
|
264
|
-
# `dialogCodeHook` and `fulfillmentActivity` on an intent).
|
569
|
+
# substitutes the session attributes and slot values that are available,
|
570
|
+
# and then returns it. The response card can also come from a Lambda
|
571
|
+
# function ( `dialogCodeHook` and `fulfillmentActivity` on an intent).
|
265
572
|
#
|
266
573
|
# @!attribute [rw] version
|
267
|
-
#
|
574
|
+
# The version of the response card format.
|
268
575
|
# @return [String]
|
269
576
|
#
|
270
577
|
# @!attribute [rw] content_type
|
271
|
-
#
|
578
|
+
# The content type of the response.
|
272
579
|
# @return [String]
|
273
580
|
#
|
274
581
|
# @!attribute [rw] generic_attachments
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-lexruntimeservice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|