ibm-watson-ruby 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a674a4fac536056ef2d77c05563611891f96c851
|
4
|
+
data.tar.gz: 65216150eda4a68e5b4c48e65731d1f36f268496
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d44956a095c2d4a24d3e50e2d777af4f09e3486c0727ca987357872f2f6a89849f5ec224f51d1ee813f822b2357ce4c16d251663cf49a8ea28dd5e769b8ae264
|
7
|
+
data.tar.gz: 79b8f541e4e55984077012cef9c87887d2e969d9111e3acb4430991ddc8ad648865fa65adc3026d8d5d5547f846ffb5a60c22746ca9984de9a21aa2ae6151810
|
@@ -2,7 +2,7 @@ module IBMWatson
|
|
2
2
|
module Conversation
|
3
3
|
class Result < IBMWatson::BaseModel
|
4
4
|
attribute :intents,
|
5
|
-
type: ::IBMWatson::Conversation::IntentResult,
|
5
|
+
type: [::IBMWatson::Conversation::IntentResult],
|
6
6
|
typecaster: lambda { |values|
|
7
7
|
values.map do |value|
|
8
8
|
::IBMWatson::Conversation::IntentResult.new(value)
|
@@ -13,6 +13,12 @@ module IBMWatson
|
|
13
13
|
attribute :output, type: Hash
|
14
14
|
attribute :context, type: Hash
|
15
15
|
attribute :alternate_intents
|
16
|
+
|
17
|
+
def as_json(*)
|
18
|
+
super.merge({
|
19
|
+
"intents" => intents.as_json
|
20
|
+
})
|
21
|
+
end
|
16
22
|
end
|
17
23
|
end
|
18
24
|
end
|
data/lib/ibm_watson/version.rb
CHANGED
@@ -15,18 +15,26 @@ describe IBMWatson::Conversation::Service, record: :none do
|
|
15
15
|
data = YAML.load_file('spec/assets/poc_workspace.json')
|
16
16
|
subject.update_workspace(workspace_id: workspace_id, workspace_data: data)
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
let(:expected_intents) { [{ "intent" => "express_delight", "confidence" => 0.99 }] }
|
20
20
|
let(:expected_context_json) { { "conversation_id" => "b90a141a-14b0-48b5-aad3-f53454e93444",
|
21
21
|
"system" => { "dialog_stack" => [{ "dialog_node" => "Introduce the Bot" }],
|
22
22
|
"dialog_turn_counter" => 1, "dialog_request_counter" => 1 },
|
23
23
|
"listing" => "none", "introduced" => true, "initial_question" => "Awesome!" } }
|
24
|
-
let(:expected_output_json) { {"log_messages"=>[], "text"=>[], "nodes_visited"=>["Conversation Starts", "Introduce the Bot"], "message_template"=>"realtor/intro",
|
25
|
-
|
24
|
+
let(:expected_output_json) { { "log_messages" => [], "text" => [], "nodes_visited" => ["Conversation Starts", "Introduce the Bot"], "message_template" => "realtor/intro",
|
25
|
+
"choices" => { "choices" => [{ "body" => "Like this?" }], "template" => "realtor/intro_question_one" }, "template" => "realtor/intro" } }
|
26
26
|
let(:conversation_id) { "b90a141a-14b0-48b5-aad3-f53454e93444" }
|
27
27
|
let(:context) {
|
28
28
|
{ conversation_id: conversation_id }
|
29
29
|
}
|
30
|
+
let(:expected_result_json) { {
|
31
|
+
"alternate_intents" => false,
|
32
|
+
"context" => { "conversation_id" => "b90a141a-14b0-48b5-aad3-f53454e93444", "system" => { "dialog_stack" => [{ "dialog_node" => "Introduce the Bot" }], "dialog_turn_counter" => 1, "dialog_request_counter" => 1 }, "listing" => "none", "introduced" => true, "initial_question" => "Awesome!" },
|
33
|
+
"entities" => [],
|
34
|
+
"input" => { "text" => "Awesome!" },
|
35
|
+
"intents" => [{ "intent" => "express_delight", "confidence" => 0.99 }],
|
36
|
+
"output" => { "log_messages" => [], "text" => [], "nodes_visited" => ["Conversation Starts", "Introduce the Bot"], "message_template" => "realtor/intro", "choices" => { "choices" => [{ "body" => "Like this?" }], "template" => "realtor/intro_question_one" }, "template" => "realtor/intro" }
|
37
|
+
} }
|
30
38
|
|
31
39
|
|
32
40
|
example do
|
@@ -37,18 +45,19 @@ describe IBMWatson::Conversation::Service, record: :none do
|
|
37
45
|
expect(result.context.as_json).to eq(expected_context_json)
|
38
46
|
expect(result.output).to be_a_kind_of(Hash)
|
39
47
|
expect(result.output.as_json).to eq(expected_output_json)
|
48
|
+
expect(result.as_json).to eq(expected_result_json)
|
40
49
|
end
|
41
50
|
end
|
42
51
|
|
43
|
-
describe "#workspace"
|
52
|
+
describe "#workspace" do
|
44
53
|
example do
|
45
54
|
result = subject.workspace(workspace_id: workspace_id, export: true)
|
46
55
|
expect(result.intents.first).to be_a_kind_of(IBMWatson::Conversation::Intent)
|
47
56
|
expect(result.dialog_nodes.first).to be_a_kind_of(IBMWatson::Conversation::DialogNode)
|
48
57
|
end
|
49
58
|
end
|
50
|
-
|
51
|
-
describe "#update_workspace"
|
59
|
+
|
60
|
+
describe "#update_workspace" do
|
52
61
|
example do
|
53
62
|
result = subject.workspace(workspace_id: workspace_id, export: true)
|
54
63
|
workspace = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibm-watson-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bram Whillock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
187
|
rubyforge_project:
|
188
|
-
rubygems_version: 2.5.
|
188
|
+
rubygems_version: 2.5.2
|
189
189
|
signing_key:
|
190
190
|
specification_version: 4
|
191
191
|
summary: IBM Watson services in ruby
|