line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Paws::LexRuntime; |
2
|
1
|
|
|
1
|
|
6211
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
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, RequestAttributes => 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 text and audio requests to Amazon Lex at runtime. Amazon Lex |
80
|
|
|
|
|
|
|
interprets the user input using the machine learning model that it |
81
|
|
|
|
|
|
|
built for the bot. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
The C<PostContent> operation supports audio input at 8kHz and 16kHz. |
84
|
|
|
|
|
|
|
You can use 8kHz audio to achieve higher speech recognition accuracy in |
85
|
|
|
|
|
|
|
telephone audio applications. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
In response, Amazon Lex returns the next message to convey to the user. |
88
|
|
|
|
|
|
|
Consider the following example messages: |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
For a user input "I would like a pizza," Amazon Lex might return a |
95
|
|
|
|
|
|
|
response with a message eliciting slot data (for example, |
96
|
|
|
|
|
|
|
C<PizzaSize>): "What size pizza would you like?". |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item * |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
After the user provides all of the pizza order information, Amazon Lex |
101
|
|
|
|
|
|
|
might return a response with a message to get user confirmation: "Order |
102
|
|
|
|
|
|
|
the pizza?". |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
After the user replies "Yes" to the confirmation prompt, Amazon Lex |
107
|
|
|
|
|
|
|
might return a conclusion statement: "Thank you, your cheese pizza has |
108
|
|
|
|
|
|
|
been ordered.". |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=back |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Not all Amazon Lex messages require a response from the user. For |
113
|
|
|
|
|
|
|
example, conclusion statements do not require a response. Some messages |
114
|
|
|
|
|
|
|
require only a yes or no response. In addition to the C<message>, |
115
|
|
|
|
|
|
|
Amazon Lex provides additional context about the message in the |
116
|
|
|
|
|
|
|
response that you can use to enhance client behavior, such as |
117
|
|
|
|
|
|
|
displaying the appropriate client user interface. Consider the |
118
|
|
|
|
|
|
|
following examples: |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=over |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
If the message is to elicit slot data, Amazon Lex returns the following |
125
|
|
|
|
|
|
|
context information: |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=over |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item * |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
C<x-amz-lex-dialog-state> header set to C<ElicitSlot> |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
C<x-amz-lex-intent-name> header set to the intent name in the current |
136
|
|
|
|
|
|
|
context |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
C<x-amz-lex-slot-to-elicit> header set to the slot name for which the |
141
|
|
|
|
|
|
|
C<message> is eliciting information |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
C<x-amz-lex-slots> header set to a map of slots configured for the |
146
|
|
|
|
|
|
|
intent with their current values |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=back |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
If the message is a confirmation prompt, the C<x-amz-lex-dialog-state> |
153
|
|
|
|
|
|
|
header is set to C<Confirmation> and the C<x-amz-lex-slot-to-elicit> |
154
|
|
|
|
|
|
|
header is omitted. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
If the message is a clarification prompt configured for the intent, |
159
|
|
|
|
|
|
|
indicating that the user intent is not understood, the |
160
|
|
|
|
|
|
|
C<x-amz-dialog-state> header is set to C<ElicitIntent> and the |
161
|
|
|
|
|
|
|
C<x-amz-slot-to-elicit> header is omitted. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=back |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
In addition, Amazon Lex also returns your application-specific |
166
|
|
|
|
|
|
|
C<sessionAttributes>. For more information, see Managing Conversation |
167
|
|
|
|
|
|
|
Context. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 PostText(BotAlias => Str, BotName => Str, InputText => Str, UserId => Str, [RequestAttributes => L<Paws::LexRuntime::StringMap>, SessionAttributes => L<Paws::LexRuntime::StringMap>]) |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Each argument is described in detail in: L<Paws::LexRuntime::PostText> |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Returns: a L<Paws::LexRuntime::PostTextResponse> instance |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Sends user input (text-only) to Amazon Lex. Client applications can use |
177
|
|
|
|
|
|
|
this API to send requests to Amazon Lex at runtime. Amazon Lex then |
178
|
|
|
|
|
|
|
interprets the user input using the machine learning model it built for |
179
|
|
|
|
|
|
|
the bot. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
In response, Amazon Lex returns the next C<message> to convey to the |
182
|
|
|
|
|
|
|
user an optional C<responseCard> to display. Consider the following |
183
|
|
|
|
|
|
|
example messages: |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=over |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item * |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
For a user input "I would like a pizza", Amazon Lex might return a |
190
|
|
|
|
|
|
|
response with a message eliciting slot data (for example, PizzaSize): |
191
|
|
|
|
|
|
|
"What size pizza would you like?" |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item * |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
After the user provides all of the pizza order information, Amazon Lex |
196
|
|
|
|
|
|
|
might return a response with a message to obtain user confirmation |
197
|
|
|
|
|
|
|
"Proceed with the pizza order?". |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item * |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
After the user replies to a confirmation prompt with a "yes", Amazon |
202
|
|
|
|
|
|
|
Lex might return a conclusion statement: "Thank you, your cheese pizza |
203
|
|
|
|
|
|
|
has been ordered.". |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=back |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Not all Amazon Lex messages require a user response. For example, a |
208
|
|
|
|
|
|
|
conclusion statement does not require a response. Some messages require |
209
|
|
|
|
|
|
|
only a "yes" or "no" user response. In addition to the C<message>, |
210
|
|
|
|
|
|
|
Amazon Lex provides additional context about the message in the |
211
|
|
|
|
|
|
|
response that you might use to enhance client behavior, for example, to |
212
|
|
|
|
|
|
|
display the appropriate client user interface. These are the |
213
|
|
|
|
|
|
|
C<slotToElicit>, C<dialogState>, C<intentName>, and C<slots> fields in |
214
|
|
|
|
|
|
|
the response. Consider the following examples: |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=over |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=item * |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
If the message is to elicit slot data, Amazon Lex returns the following |
221
|
|
|
|
|
|
|
context information: |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=over |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=item * |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
C<dialogState> set to ElicitSlot |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=item * |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
C<intentName> set to the intent name in the current context |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=item * |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
C<slotToElicit> set to the slot name for which the C<message> is |
236
|
|
|
|
|
|
|
eliciting information |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=item * |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
C<slots> set to a map of slots, configured for the intent, with |
241
|
|
|
|
|
|
|
currently known values |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=back |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=item * |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
If the message is a confirmation prompt, the C<dialogState> is set to |
248
|
|
|
|
|
|
|
ConfirmIntent and C<SlotToElicit> is set to null. |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=item * |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
If the message is a clarification prompt (configured for the intent) |
253
|
|
|
|
|
|
|
that indicates that user intent is not understood, the C<dialogState> |
254
|
|
|
|
|
|
|
is set to ElicitIntent and C<slotToElicit> is set to null. |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=back |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
In addition, Amazon Lex also returns your application-specific |
259
|
|
|
|
|
|
|
C<sessionAttributes>. For more information, see Managing Conversation |
260
|
|
|
|
|
|
|
Context. |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=head1 PAGINATORS |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
Paginator methods are helpers that repetively call methods that return partial results |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=head1 SEE ALSO |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
This service class forms part of L<Paws> |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=head1 BUGS and CONTRIBUTIONS |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
The source code is located here: https://github.com/pplu/aws-sdk-perl |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
Please report bugs to: https://github.com/pplu/aws-sdk-perl/issues |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=cut |
283
|
|
|
|
|
|
|
|