aws-lex-conversation 4.0.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +44 -0
- data/lib/aws/lex/conversation/handler/echo.rb +6 -4
- data/lib/aws/lex/conversation/response/elicit_intent.rb +2 -0
- data/lib/aws/lex/conversation/slot/elicitation.rb +5 -1
- data/lib/aws/lex/conversation/type/base.rb +5 -3
- data/lib/aws/lex/conversation/type/event.rb +1 -1
- data/lib/aws/lex/conversation/type/fulfillment_state.rb +2 -0
- data/lib/aws/lex/conversation/type/intent.rb +4 -4
- data/lib/aws/lex/conversation/type/session_attributes.rb +4 -6
- data/lib/aws/lex/conversation/type/session_state.rb +1 -1
- data/lib/aws/lex/conversation/type/slot_value.rb +8 -0
- data/lib/aws/lex/conversation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10b9a6aa5e59e3f2c016255c6fbd46f30631ece6c981fa81d45c2b300f676041
|
4
|
+
data.tar.gz: a49c289a1c5cf5189f3f87e971a32947dc5ab2a6380189b39c8544c1d5792c20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c94e997fba06c3658c53d0a51dd4b67a0c3f75118fddd7ba0430ecba2e8433d4e601ba9da5e14d7307d200c97bdda47f74e35809b0e4ae95883c6572365e311e
|
7
|
+
data.tar.gz: 8734811c21883cc5ba09a234bbd04a1cd6fcf5b98f189406da843c30ea631c19fc0e32ae2a95a7bfdda6985f849ba4e2804f3e3897a3a46eebc9b2de6eb2396d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,47 @@
|
|
1
|
+
# 4.1.0 - July 21, 2021
|
2
|
+
|
3
|
+
* Don't set the `intent` property in the response for `ElicitIntent`
|
4
|
+
actions as the field is optional as per [AWS documentation](https://docs.aws.amazon.com/lexv2/latest/dg/lambda.html#lambda-response-format).
|
5
|
+
* Add `InProgress` and `ReadyForFulfillment` enumerations to `FulfillmentState`.
|
6
|
+
|
7
|
+
# 4.0.1 - July 16, 2021
|
8
|
+
|
9
|
+
* Fix a bug with the `Aws::Lex::Conversation::Handler::Echo` class because it
|
10
|
+
didn't correctly return an array of messages required for Lex V2.
|
11
|
+
* Drop a call to `Hash#deep_symbolize_keys` so we don't implicitly rely on
|
12
|
+
ActiveSupport.
|
13
|
+
* Call `Hash#compact` when transforming a Lex response so we don't include any
|
14
|
+
`nil` values in the response.
|
15
|
+
|
16
|
+
# 4.0.0 - July 14, 2021
|
17
|
+
|
18
|
+
**breaking change** - Drop support for the Lex runtime version 1. If you are using Lex Version 1, please lock this gem to `~> 3.0.0`.
|
19
|
+
**breaking change** - Implement support and types for [Lex Version 2](https://docs.aws.amazon.com/lexv2/latest/dg/what-is.html), which implements a new Lambda [input/output event format](https://docs.aws.amazon.com/lexv2/latest/dg/lambda.html#lambda-input-format).
|
20
|
+
|
21
|
+
# 3.1.0 - June 1, 2021
|
22
|
+
|
23
|
+
* Default both `request_attributes` and `session_attributes`
|
24
|
+
to an empty Hash when the values from the event are `null`.
|
25
|
+
It is much easier to reason and write logic when you can
|
26
|
+
assume that these values are always at least a hash.
|
27
|
+
|
28
|
+
# 3.0.0 - May 20, 2021
|
29
|
+
|
30
|
+
* **breaking change** - Don't pass the `recentIntentSummaryView` back
|
31
|
+
in the Lex response unless we have modified or added an existing
|
32
|
+
checkpoint. Lex will persist the previous intent summary/history
|
33
|
+
if we do not send a `recentIntentSummaryView` value back in the
|
34
|
+
response (see [1]).
|
35
|
+
* Add a few helper methods to the `Aws::Lex::Conversation::Type::Slot`
|
36
|
+
instances:
|
37
|
+
|
38
|
+
- `active?`: returns true if the slot is defined (either optional or
|
39
|
+
required) for the current intent.
|
40
|
+
- `requestable?`: returns true if the slot is active for the current
|
41
|
+
intent and it is not filled.
|
42
|
+
|
43
|
+
[1]: https://docs.aws.amazon.com/lex/latest/dg/lambda-input-response-format.html#lambda-response-recentIntentSummaryView
|
44
|
+
|
1
45
|
# 2.0.0 - August 19, 2020
|
2
46
|
|
3
47
|
* **breaking change:** Rename `Aws::Lex::Conversation::Type::CurrentIntent` to `Aws::Lex::Conversation::Type::Intent`.
|
@@ -11,10 +11,12 @@ module Aws
|
|
11
11
|
fulfillment_state = options.fetch(:fulfillment_state) { Type::FulfillmentState.new('Fulfilled') }
|
12
12
|
conversation.close(
|
13
13
|
fulfillment_state: fulfillment_state,
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
messages: [
|
15
|
+
Type::Message.new(
|
16
|
+
content: content,
|
17
|
+
content_type: content_type
|
18
|
+
)
|
19
|
+
]
|
18
20
|
)
|
19
21
|
end
|
20
22
|
end
|
@@ -29,13 +29,17 @@ module Aws
|
|
29
29
|
slot_to_elicit: name,
|
30
30
|
messages: [
|
31
31
|
{
|
32
|
-
contentType:
|
32
|
+
contentType: message_content_type,
|
33
33
|
content: elicitation_content
|
34
34
|
}
|
35
35
|
]
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
39
|
+
def message_content_type
|
40
|
+
content_type.is_a?(Proc) ? content_type.call(conversation) : content_type
|
41
|
+
end
|
42
|
+
|
39
43
|
def elicit?
|
40
44
|
elicit.call(conversation) && !slot.filled?
|
41
45
|
end
|
@@ -26,10 +26,11 @@ module Aws
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def to_lex
|
29
|
-
self.class.attributes.each_with_object({}) do |attribute, hash|
|
29
|
+
output = self.class.attributes.each_with_object({}) do |attribute, hash|
|
30
30
|
value = transform_to_lex(public_send(attribute))
|
31
31
|
hash[self.class.mapping.fetch(attribute)] = value
|
32
32
|
end
|
33
|
+
output.compact
|
33
34
|
end
|
34
35
|
|
35
36
|
private
|
@@ -40,9 +41,10 @@ module Aws
|
|
40
41
|
if value.respond_to?(:to_lex)
|
41
42
|
value.to_lex
|
42
43
|
else
|
43
|
-
value.each_with_object({}) do |(key, val), hash|
|
44
|
+
output = value.each_with_object({}) do |(key, val), hash|
|
44
45
|
hash[key.to_sym] = transform_to_lex(val)
|
45
46
|
end
|
47
|
+
output.compact
|
46
48
|
end
|
47
49
|
when Array
|
48
50
|
value.map { |v| transform_to_lex(v) }
|
@@ -66,7 +68,7 @@ module Aws
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def symbolize_hash!
|
69
|
-
->(v) { v.
|
71
|
+
->(v) { v.transform_keys(&:to_sym) }
|
70
72
|
end
|
71
73
|
|
72
74
|
def computed_property(attribute, callable)
|
@@ -22,13 +22,13 @@ module Aws
|
|
22
22
|
end
|
23
23
|
|
24
24
|
instance.raw_slots.each_with_object(default_hash) do |(key, value), hash|
|
25
|
-
value
|
25
|
+
normalized = value&.transform_keys(&:to_sym) || { shape: 'Scalar' }
|
26
26
|
hash[key.to_sym] = Slot.shrink_wrap(
|
27
27
|
active: true,
|
28
28
|
name: key,
|
29
|
-
shape:
|
30
|
-
value:
|
31
|
-
values:
|
29
|
+
shape: normalized[:shape],
|
30
|
+
value: normalized[:value],
|
31
|
+
values: normalized[:values]
|
32
32
|
)
|
33
33
|
end
|
34
34
|
end
|
@@ -10,12 +10,10 @@ module Aws
|
|
10
10
|
optional :checkpoints
|
11
11
|
|
12
12
|
def checkpoints
|
13
|
-
@checkpoints ||=
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Checkpoint.shrink_wrap(checkpoint)
|
18
|
-
end
|
13
|
+
@checkpoints ||= JSON.parse(
|
14
|
+
Base64.urlsafe_decode64(fetch(:checkpoints) { Base64.urlsafe_encode64([].to_json, padding: false) })
|
15
|
+
).map do |checkpoint|
|
16
|
+
Checkpoint.shrink_wrap(checkpoint)
|
19
17
|
end
|
20
18
|
end
|
21
19
|
|
@@ -16,7 +16,7 @@ module Aws
|
|
16
16
|
active_contexts: Array[Context],
|
17
17
|
dialog_action: DialogAction,
|
18
18
|
intent: Intent,
|
19
|
-
session_attributes: ->(v) { SessionAttributes[v.
|
19
|
+
session_attributes: ->(v) { SessionAttributes[v.transform_keys(&:to_sym)] }
|
20
20
|
)
|
21
21
|
end
|
22
22
|
end
|
@@ -14,6 +14,14 @@ module Aws
|
|
14
14
|
alias_method :value, :interpreted_value
|
15
15
|
alias_method :value=, :interpreted_value=
|
16
16
|
|
17
|
+
def to_lex
|
18
|
+
{
|
19
|
+
interpretedValue: interpreted_value,
|
20
|
+
originalValue: original_value,
|
21
|
+
resolvedValues: resolved_values
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
17
25
|
def resolve!(index: 0)
|
18
26
|
self.interpreted_value = resolved(index: index)
|
19
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-lex-conversation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jesse Doyle
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: exe
|
14
14
|
cert_chain: []
|
15
|
-
date: 2021-
|
15
|
+
date: 2021-08-23 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: shrink_wrap
|