line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Paws::LexRuntime; |
2
|
1
|
|
|
1
|
|
4744
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
3
|
|
|
|
|
|
|
sub service { 'runtime.lex' } |
4
|
|
|
|
|
|
|
sub version { '2016-11-28' } |
5
|
|
|
|
|
|
|
sub flattened_arrays { 0 } |
6
|
|
|
|
|
|
|
has max_attempts => (is => 'ro', isa => 'Int', default => 5); |
7
|
|
|
|
|
|
|
has retry => (is => 'ro', isa => 'HashRef', default => sub { |
8
|
|
|
|
|
|
|
{ base => 'rand', type => 'exponential', growth_factor => 2 } |
9
|
|
|
|
|
|
|
}); |
10
|
|
|
|
|
|
|
has retriables => (is => 'ro', isa => 'ArrayRef', default => sub { [ |
11
|
|
|
|
|
|
|
] }); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Paws::API::Caller', 'Paws::API::EndpointResolver', 'Paws::Net::V4Signature', 'Paws::Net::RestJsonCaller', 'Paws::Net::RestJsonResponse'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub PostContent { |
17
|
|
|
|
|
|
|
my $self = shift; |
18
|
|
|
|
|
|
|
my $call_object = $self->new_with_coercions('Paws::LexRuntime::PostContent', @_); |
19
|
|
|
|
|
|
|
return $self->caller->do_call($self, $call_object); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
sub PostText { |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
my $call_object = $self->new_with_coercions('Paws::LexRuntime::PostText', @_); |
24
|
|
|
|
|
|
|
return $self->caller->do_call($self, $call_object); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub operations { qw/PostContent PostText / } |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
### main pod documentation begin ### |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Paws::LexRuntime - Perl Interface to AWS Amazon Lex Runtime Service |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
use Paws; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $obj = Paws->service('LexRuntime'); |
44
|
|
|
|
|
|
|
my $res = $obj->Method( |
45
|
|
|
|
|
|
|
Arg1 => $val1, |
46
|
|
|
|
|
|
|
Arg2 => [ 'V1', 'V2' ], |
47
|
|
|
|
|
|
|
# if Arg3 is an object, the HashRef will be used as arguments to the constructor |
48
|
|
|
|
|
|
|
# of the arguments type |
49
|
|
|
|
|
|
|
Arg3 => { Att1 => 'Val1' }, |
50
|
|
|
|
|
|
|
# if Arg4 is an array of objects, the HashRefs will be passed as arguments to |
51
|
|
|
|
|
|
|
# the constructor of the arguments type |
52
|
|
|
|
|
|
|
Arg4 => [ { Att1 => 'Val1' }, { Att1 => 'Val2' } ], |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Amazon Lex provides both build and runtime endpoints. Each endpoint |
58
|
|
|
|
|
|
|
provides a set of operations (API). Your conversational bot uses the |
59
|
|
|
|
|
|
|
runtime API to understand user utterances (user input text or voice). |
60
|
|
|
|
|
|
|
For example, suppose a user says "I want pizza", your bot sends this |
61
|
|
|
|
|
|
|
input to Amazon Lex using the runtime API. Amazon Lex recognizes that |
62
|
|
|
|
|
|
|
the user request is for the OrderPizza intent (one of the intents |
63
|
|
|
|
|
|
|
defined in the bot). Then Amazon Lex engages in user conversation on |
64
|
|
|
|
|
|
|
behalf of the bot to elicit required information (slot values, such as |
65
|
|
|
|
|
|
|
pizza size and crust type), and then performs fulfillment activity |
66
|
|
|
|
|
|
|
(that you configured when you created the bot). You use the build-time |
67
|
|
|
|
|
|
|
API to create and manage your Amazon Lex bot. For a list of build-time |
68
|
|
|
|
|
|
|
operations, see the build-time API, . |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 METHODS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 PostContent(BotAlias => Str, BotName => Str, ContentType => Str, InputStream => Str, UserId => Str, [Accept => Str, SessionAttributes => Str]) |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Each argument is described in detail in: L<Paws::LexRuntime::PostContent> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Returns: a L<Paws::LexRuntime::PostContentResponse> instance |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Sends user input (text or speech) to Amazon Lex. Clients use this API |
79
|
|
|
|
|
|
|
to send requests to Amazon Lex at runtime. Amazon Lex interprets the |
80
|
|
|
|
|
|
|
user input using the machine learning model that it built for the bot. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
In response, Amazon Lex returns the next message to convey to the user. |
83
|
|
|
|
|
|
|
Consider the following example messages: |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=over |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
For a user input "I would like a pizza," Amazon Lex might return a |
90
|
|
|
|
|
|
|
response with a message eliciting slot data (for example, |
91
|
|
|
|
|
|
|
C<PizzaSize>): "What size pizza would you like?". |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item * |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
After the user provides all of the pizza order information, Amazon Lex |
96
|
|
|
|
|
|
|
might return a response with a message to get user confirmation: "Order |
97
|
|
|
|
|
|
|
the pizza?". |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
After the user replies "Yes" to the confirmation prompt, Amazon Lex |
102
|
|
|
|
|
|
|
might return a conclusion statement: "Thank you, your cheese pizza has |
103
|
|
|
|
|
|
|
been ordered.". |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Not all Amazon Lex messages require a response from the user. For |
108
|
|
|
|
|
|
|
example, conclusion statements do not require a response. Some messages |
109
|
|
|
|
|
|
|
require only a yes or no response. In addition to the C<message>, |
110
|
|
|
|
|
|
|
Amazon Lex provides additional context about the message in the |
111
|
|
|
|
|
|
|
response that you can use to enhance client behavior, such as |
112
|
|
|
|
|
|
|
displaying the appropriate client user interface. Consider the |
113
|
|
|
|
|
|
|
following examples: |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=over |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
If the message is to elicit slot data, Amazon Lex returns the following |
120
|
|
|
|
|
|
|
context information: |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=over |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
C<x-amz-lex-dialog-state> header set to C<ElicitSlot> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
C<x-amz-lex-intent-name> header set to the intent name in the current |
131
|
|
|
|
|
|
|
context |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
C<x-amz-lex-slot-to-elicit> header set to the slot name for which the |
136
|
|
|
|
|
|
|
C<message> is eliciting information |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
C<x-amz-lex-slots> header set to a map of slots configured for the |
141
|
|
|
|
|
|
|
intent with their current values |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=back |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item * |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
If the message is a confirmation prompt, the C<x-amz-lex-dialog-state> |
148
|
|
|
|
|
|
|
header is set to C<Confirmation> and the C<x-amz-lex-slot-to-elicit> |
149
|
|
|
|
|
|
|
header is omitted. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
If the message is a clarification prompt configured for the intent, |
154
|
|
|
|
|
|
|
indicating that the user intent is not understood, the |
155
|
|
|
|
|
|
|
C<x-amz-dialog-state> header is set to C<ElicitIntent> and the |
156
|
|
|
|
|
|
|
C<x-amz-slot-to-elicit> header is omitted. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=back |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
In addition, Amazon Lex also returns your application-specific |
161
|
|
|
|
|
|
|
C<sessionAttributes>. For more information, see Managing Conversation |
162
|
|
|
|
|
|
|
Context. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 PostText(BotAlias => Str, BotName => Str, InputText => Str, UserId => Str, [SessionAttributes => L<Paws::LexRuntime::StringMap>]) |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Each argument is described in detail in: L<Paws::LexRuntime::PostText> |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Returns: a L<Paws::LexRuntime::PostTextResponse> instance |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Sends user input (text-only) to Amazon Lex. Client applications can use |
172
|
|
|
|
|
|
|
this API to send requests to Amazon Lex at runtime. Amazon Lex then |
173
|
|
|
|
|
|
|
interprets the user input using the machine learning model it built for |
174
|
|
|
|
|
|
|
the bot. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
In response, Amazon Lex returns the next C<message> to convey to the |
177
|
|
|
|
|
|
|
user an optional C<responseCard> to display. Consider the following |
178
|
|
|
|
|
|
|
example messages: |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=over |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item * |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
For a user input "I would like a pizza", Amazon Lex might return a |
185
|
|
|
|
|
|
|
response with a message eliciting slot data (for example, PizzaSize): |
186
|
|
|
|
|
|
|
"What size pizza would you like?" |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
After the user provides all of the pizza order information, Amazon Lex |
191
|
|
|
|
|
|
|
might return a response with a message to obtain user confirmation |
192
|
|
|
|
|
|
|
"Proceed with the pizza order?". |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item * |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
After the user replies to a confirmation prompt with a "yes", Amazon |
197
|
|
|
|
|
|
|
Lex might return a conclusion statement: "Thank you, your cheese pizza |
198
|
|
|
|
|
|
|
has been ordered.". |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=back |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Not all Amazon Lex messages require a user response. For example, a |
203
|
|
|
|
|
|
|
conclusion statement does not require a response. Some messages require |
204
|
|
|
|
|
|
|
only a "yes" or "no" user response. In addition to the C<message>, |
205
|
|
|
|
|
|
|
Amazon Lex provides additional context about the message in the |
206
|
|
|
|
|
|
|
response that you might use to enhance client behavior, for example, to |
207
|
|
|
|
|
|
|
display the appropriate client user interface. These are the |
208
|
|
|
|
|
|
|
C<slotToElicit>, C<dialogState>, C<intentName>, and C<slots> fields in |
209
|
|
|
|
|
|
|
the response. Consider the following examples: |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=over |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item * |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
If the message is to elicit slot data, Amazon Lex returns the following |
216
|
|
|
|
|
|
|
context information: |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=over |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item * |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
C<dialogState> set to ElicitSlot |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=item * |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
C<intentName> set to the intent name in the current context |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item * |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
C<slotToElicit> set to the slot name for which the C<message> is |
231
|
|
|
|
|
|
|
eliciting information |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=item * |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
C<slots> set to a map of slots, configured for the intent, with |
236
|
|
|
|
|
|
|
currently known values |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=back |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=item * |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
If the message is a confirmation prompt, the C<dialogState> is set to |
243
|
|
|
|
|
|
|
ConfirmIntent and C<SlotToElicit> is set to null. |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=item * |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
If the message is a clarification prompt (configured for the intent) |
248
|
|
|
|
|
|
|
that indicates that user intent is not understood, the C<dialogState> |
249
|
|
|
|
|
|
|
is set to ElicitIntent and C<slotToElicit> is set to null. |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=back |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
In addition, Amazon Lex also returns your application-specific |
254
|
|
|
|
|
|
|
C<sessionAttributes>. For more information, see Managing Conversation |
255
|
|
|
|
|
|
|
Context. |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=head1 PAGINATORS |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
Paginator methods are helpers that repetively call methods that return partial results |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head1 SEE ALSO |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
This service class forms part of L<Paws> |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head1 BUGS and CONTRIBUTIONS |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
The source code is located here: https://github.com/pplu/aws-sdk-perl |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=cut |
278
|
|
|
|
|
|
|
|