ibm_watson 2.0.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ibm_watson/assistant_v1.rb +111 -77
- data/lib/ibm_watson/assistant_v2.rb +83 -59
- data/lib/ibm_watson/compare_comply_v1.rb +11 -4
- data/lib/ibm_watson/discovery_v1.rb +2 -3
- data/lib/ibm_watson/discovery_v2.rb +97 -7
- data/lib/ibm_watson/language_translator_v3.rb +1 -2
- data/lib/ibm_watson/natural_language_classifier_v1.rb +1 -2
- data/lib/ibm_watson/natural_language_understanding_v1.rb +692 -3
- data/lib/ibm_watson/personality_insights_v3.rb +13 -11
- data/lib/ibm_watson/speech_to_text_v1.rb +257 -106
- data/lib/ibm_watson/text_to_speech_v1.rb +601 -19
- data/lib/ibm_watson/tone_analyzer_v3.rb +1 -2
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +1 -2
- data/lib/ibm_watson/visual_recognition_v4.rb +11 -8
- data/test/integration/test_discovery_v2.rb +15 -0
- data/test/integration/test_natural_language_understanding_v1.rb +134 -1
- data/test/integration/test_text_to_speech_v1.rb +57 -0
- data/test/unit/test_discovery_v2.rb +29 -0
- data/test/unit/test_natural_language_understanding_v1.rb +231 -0
- data/test/unit/test_text_to_speech_v1.rb +145 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a856f95170a6ba51cbb7ea7dc4e04e9e5f99ed57d292c642b566e1c9017c3e9e
|
4
|
+
data.tar.gz: e81652472da29d3032abef05ebd539b639f73be51f0e91455d19bea389c29105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b63bfa564a2e2ddefd1de282f0e0d228211fcfcd8f662136c8fe77a870f39e28b6e88772460aa9b43a652e523c16f116449de79c340bb72d94e3a9f962b95992
|
7
|
+
data.tar.gz: 7d5ec257697c47db06505a8948ed27e434eab18bb56171d298d9569a3c1cd7cae2711a7a19cb63d78d97ba32fa54a8d1da60db8716e5e3c04b3e2ad2a3517235
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ Ruby gem to quickly get started with the various [IBM Watson][wdc] services.
|
|
38
38
|
|
39
39
|
</details>
|
40
40
|
|
41
|
-
##
|
41
|
+
## Announcements
|
42
42
|
### Support for 2.7 ruby
|
43
43
|
To support 2.7 the http gem dependency is updated to 4.4.0. Since it conflicted with the dependency in the ruby-sdk-core that gem was also updated. Using 2.0.2 or above ruby sdk will require a core of 1.1.3 or above.
|
44
44
|
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
|
-
# IBM OpenAPI SDK Code Generator Version: 3.
|
17
|
+
# IBM OpenAPI SDK Code Generator Version: 3.31.0-902c9336-20210504-161156
|
18
18
|
#
|
19
19
|
# The IBM Watson™ Assistant service combines machine learning, natural language
|
20
20
|
# understanding, and an integrated dialog editor to create conversation flows between your
|
@@ -29,7 +29,6 @@ require "json"
|
|
29
29
|
require "ibm_cloud_sdk_core"
|
30
30
|
require_relative "./common.rb"
|
31
31
|
|
32
|
-
# Module for the Watson APIs
|
33
32
|
module IBMWatson
|
34
33
|
##
|
35
34
|
# The Assistant V1 service.
|
@@ -72,7 +71,7 @@ module IBMWatson
|
|
72
71
|
#########################
|
73
72
|
|
74
73
|
##
|
75
|
-
# @!method message(workspace_id:, input: nil, intents: nil, entities: nil, alternate_intents: nil, context: nil, output: nil, nodes_visited_details: nil)
|
74
|
+
# @!method message(workspace_id:, input: nil, intents: nil, entities: nil, alternate_intents: nil, context: nil, output: nil, user_id: nil, nodes_visited_details: nil)
|
76
75
|
# Get response to user input.
|
77
76
|
# Send user input to a workspace and receive a response.
|
78
77
|
#
|
@@ -94,10 +93,20 @@ module IBMWatson
|
|
94
93
|
# from the previous response.
|
95
94
|
# @param output [OutputData] An output object that includes the response to the user, the dialog nodes that
|
96
95
|
# were triggered, and messages from the log.
|
96
|
+
# @param user_id [String] A string value that identifies the user who is interacting with the workspace. The
|
97
|
+
# client must provide a unique identifier for each individual end user who accesses
|
98
|
+
# the application. For user-based plans, this user ID is used to identify unique
|
99
|
+
# users for billing purposes. This string cannot contain carriage return, newline,
|
100
|
+
# or tab characters. If no value is specified in the input, **user_id** is
|
101
|
+
# automatically set to the value of **context.conversation_id**.
|
102
|
+
#
|
103
|
+
# **Note:** This property is the same as the **user_id** property in the context
|
104
|
+
# metadata. If **user_id** is specified in both locations in a message request, the
|
105
|
+
# value specified at the root is used.
|
97
106
|
# @param nodes_visited_details [Boolean] Whether to include additional diagnostic information about the dialog nodes that
|
98
107
|
# were visited during processing of the message.
|
99
108
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
100
|
-
def message(workspace_id:, input: nil, intents: nil, entities: nil, alternate_intents: nil, context: nil, output: nil, nodes_visited_details: nil)
|
109
|
+
def message(workspace_id:, input: nil, intents: nil, entities: nil, alternate_intents: nil, context: nil, output: nil, user_id: nil, nodes_visited_details: nil)
|
101
110
|
raise ArgumentError.new("workspace_id must be provided") if workspace_id.nil?
|
102
111
|
|
103
112
|
raise ArgumentError.new("version must be provided") if version.nil?
|
@@ -118,7 +127,8 @@ module IBMWatson
|
|
118
127
|
"entities" => entities,
|
119
128
|
"alternate_intents" => alternate_intents,
|
120
129
|
"context" => context,
|
121
|
-
"output" => output
|
130
|
+
"output" => output,
|
131
|
+
"user_id" => user_id
|
122
132
|
}
|
123
133
|
|
124
134
|
method_url = "/v1/workspaces/%s/message" % [ERB::Util.url_encode(workspace_id)]
|
@@ -134,6 +144,51 @@ module IBMWatson
|
|
134
144
|
response
|
135
145
|
end
|
136
146
|
#########################
|
147
|
+
# Bulk classify
|
148
|
+
#########################
|
149
|
+
|
150
|
+
##
|
151
|
+
# @!method bulk_classify(workspace_id:, input: nil)
|
152
|
+
# Identify intents and entities in multiple user utterances.
|
153
|
+
# Send multiple user inputs to a workspace in a single request and receive
|
154
|
+
# information about the intents and entities recognized in each input. This method
|
155
|
+
# is useful for testing and comparing the performance of different workspaces.
|
156
|
+
#
|
157
|
+
# This method is available only with Enterprise with Data Isolation plans.
|
158
|
+
# @param workspace_id [String] Unique identifier of the workspace.
|
159
|
+
# @param input [Array[BulkClassifyUtterance]] An array of input utterances to classify.
|
160
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
161
|
+
def bulk_classify(workspace_id:, input: nil)
|
162
|
+
raise ArgumentError.new("workspace_id must be provided") if workspace_id.nil?
|
163
|
+
|
164
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
165
|
+
|
166
|
+
headers = {
|
167
|
+
}
|
168
|
+
sdk_headers = Common.new.get_sdk_headers("conversation", "V1", "bulk_classify")
|
169
|
+
headers.merge!(sdk_headers)
|
170
|
+
|
171
|
+
params = {
|
172
|
+
"version" => @version
|
173
|
+
}
|
174
|
+
|
175
|
+
data = {
|
176
|
+
"input" => input
|
177
|
+
}
|
178
|
+
|
179
|
+
method_url = "/v1/workspaces/%s/bulk_classify" % [ERB::Util.url_encode(workspace_id)]
|
180
|
+
|
181
|
+
response = request(
|
182
|
+
method: "POST",
|
183
|
+
url: method_url,
|
184
|
+
headers: headers,
|
185
|
+
params: params,
|
186
|
+
json: data,
|
187
|
+
accept_json: true
|
188
|
+
)
|
189
|
+
response
|
190
|
+
end
|
191
|
+
#########################
|
137
192
|
# Workspaces
|
138
193
|
#########################
|
139
194
|
|
@@ -2009,27 +2064,34 @@ module IBMWatson
|
|
2009
2064
|
# If you want to create multiple dialog nodes with a single API call, consider using
|
2010
2065
|
# the **[Update workspace](#update-workspace)** method instead.
|
2011
2066
|
# @param workspace_id [String] Unique identifier of the workspace.
|
2012
|
-
# @param dialog_node [String] The dialog node
|
2013
|
-
#
|
2014
|
-
#
|
2067
|
+
# @param dialog_node [String] The unique ID of the dialog node. This is an internal identifier used to refer to
|
2068
|
+
# the dialog node from other dialog nodes and in the diagnostic information included
|
2069
|
+
# with message responses.
|
2070
|
+
#
|
2071
|
+
# This string can contain only Unicode alphanumeric, space, underscore, hyphen, and
|
2072
|
+
# dot characters.
|
2015
2073
|
# @param description [String] The description of the dialog node. This string cannot contain carriage return,
|
2016
2074
|
# newline, or tab characters.
|
2017
2075
|
# @param conditions [String] The condition that will trigger the dialog node. This string cannot contain
|
2018
2076
|
# carriage return, newline, or tab characters.
|
2019
|
-
# @param parent [String] The ID of the parent dialog node. This property is omitted if the dialog
|
2020
|
-
# no parent.
|
2021
|
-
# @param previous_sibling [String] The ID of the previous sibling dialog node. This property is omitted if the
|
2022
|
-
# node has no previous sibling.
|
2077
|
+
# @param parent [String] The unique ID of the parent dialog node. This property is omitted if the dialog
|
2078
|
+
# node has no parent.
|
2079
|
+
# @param previous_sibling [String] The unique ID of the previous sibling dialog node. This property is omitted if the
|
2080
|
+
# dialog node has no previous sibling.
|
2023
2081
|
# @param output [DialogNodeOutput] The output of the dialog node. For more information about how to specify dialog
|
2024
2082
|
# node output, see the
|
2025
2083
|
# [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview#dialog-overview-responses).
|
2026
2084
|
# @param context [DialogNodeContext] The context for the dialog node.
|
2027
2085
|
# @param metadata [Hash] The metadata for the dialog node.
|
2028
2086
|
# @param next_step [DialogNodeNextStep] The next step to execute following this dialog node.
|
2029
|
-
# @param title [String]
|
2030
|
-
#
|
2031
|
-
#
|
2032
|
-
#
|
2087
|
+
# @param title [String] A human-readable name for the dialog node. If the node is included in
|
2088
|
+
# disambiguation, this title is used to populate the **label** property of the
|
2089
|
+
# corresponding suggestion in the `suggestion` response type (unless it is
|
2090
|
+
# overridden by the **user_label** property). The title is also used to populate the
|
2091
|
+
# **topic** property in the `connect_to_agent` response type.
|
2092
|
+
#
|
2093
|
+
# This string can contain only Unicode alphanumeric, space, underscore, hyphen, and
|
2094
|
+
# dot characters.
|
2033
2095
|
# @param type [String] How the dialog node is processed.
|
2034
2096
|
# @param event_name [String] How an `event_handler` node is processed.
|
2035
2097
|
# @param variable [String] The location in the dialog context where output is stored.
|
@@ -2038,7 +2100,8 @@ module IBMWatson
|
|
2038
2100
|
# @param digress_out [String] Whether this dialog node can be returned to after a digression.
|
2039
2101
|
# @param digress_out_slots [String] Whether the user can digress to top-level nodes while filling out slots.
|
2040
2102
|
# @param user_label [String] A label that can be displayed externally to describe the purpose of the node to
|
2041
|
-
# users.
|
2103
|
+
# users. If set, this label is used to identify the node in disambiguation responses
|
2104
|
+
# (overriding the value of the **title** property).
|
2042
2105
|
# @param disambiguation_opt_out [Boolean] Whether the dialog node should be excluded from disambiguation suggestions. Valid
|
2043
2106
|
# only when **type**=`standard` or `frame`.
|
2044
2107
|
# @param include_audit [Boolean] Whether to include the audit properties (`created` and `updated` timestamps) in
|
@@ -2101,7 +2164,7 @@ module IBMWatson
|
|
2101
2164
|
# Get dialog node.
|
2102
2165
|
# Get information about a dialog node.
|
2103
2166
|
# @param workspace_id [String] Unique identifier of the workspace.
|
2104
|
-
# @param dialog_node [String] The dialog node ID (for example, `
|
2167
|
+
# @param dialog_node [String] The dialog node ID (for example, `node_1_1479323581900`).
|
2105
2168
|
# @param include_audit [Boolean] Whether to include the audit properties (`created` and `updated` timestamps) in
|
2106
2169
|
# the response.
|
2107
2170
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
@@ -2142,28 +2205,35 @@ module IBMWatson
|
|
2142
2205
|
# If you want to update multiple dialog nodes with a single API call, consider using
|
2143
2206
|
# the **[Update workspace](#update-workspace)** method instead.
|
2144
2207
|
# @param workspace_id [String] Unique identifier of the workspace.
|
2145
|
-
# @param dialog_node [String] The dialog node ID (for example, `
|
2146
|
-
# @param new_dialog_node [String] The dialog node
|
2147
|
-
#
|
2148
|
-
#
|
2208
|
+
# @param dialog_node [String] The dialog node ID (for example, `node_1_1479323581900`).
|
2209
|
+
# @param new_dialog_node [String] The unique ID of the dialog node. This is an internal identifier used to refer to
|
2210
|
+
# the dialog node from other dialog nodes and in the diagnostic information included
|
2211
|
+
# with message responses.
|
2212
|
+
#
|
2213
|
+
# This string can contain only Unicode alphanumeric, space, underscore, hyphen, and
|
2214
|
+
# dot characters.
|
2149
2215
|
# @param new_description [String] The description of the dialog node. This string cannot contain carriage return,
|
2150
2216
|
# newline, or tab characters.
|
2151
2217
|
# @param new_conditions [String] The condition that will trigger the dialog node. This string cannot contain
|
2152
2218
|
# carriage return, newline, or tab characters.
|
2153
|
-
# @param new_parent [String] The ID of the parent dialog node. This property is omitted if the dialog
|
2154
|
-
# no parent.
|
2155
|
-
# @param new_previous_sibling [String] The ID of the previous sibling dialog node. This property is omitted if the
|
2156
|
-
# node has no previous sibling.
|
2219
|
+
# @param new_parent [String] The unique ID of the parent dialog node. This property is omitted if the dialog
|
2220
|
+
# node has no parent.
|
2221
|
+
# @param new_previous_sibling [String] The unique ID of the previous sibling dialog node. This property is omitted if the
|
2222
|
+
# dialog node has no previous sibling.
|
2157
2223
|
# @param new_output [DialogNodeOutput] The output of the dialog node. For more information about how to specify dialog
|
2158
2224
|
# node output, see the
|
2159
2225
|
# [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-overview#dialog-overview-responses).
|
2160
2226
|
# @param new_context [DialogNodeContext] The context for the dialog node.
|
2161
2227
|
# @param new_metadata [Hash] The metadata for the dialog node.
|
2162
2228
|
# @param new_next_step [DialogNodeNextStep] The next step to execute following this dialog node.
|
2163
|
-
# @param new_title [String]
|
2164
|
-
#
|
2165
|
-
#
|
2166
|
-
#
|
2229
|
+
# @param new_title [String] A human-readable name for the dialog node. If the node is included in
|
2230
|
+
# disambiguation, this title is used to populate the **label** property of the
|
2231
|
+
# corresponding suggestion in the `suggestion` response type (unless it is
|
2232
|
+
# overridden by the **user_label** property). The title is also used to populate the
|
2233
|
+
# **topic** property in the `connect_to_agent` response type.
|
2234
|
+
#
|
2235
|
+
# This string can contain only Unicode alphanumeric, space, underscore, hyphen, and
|
2236
|
+
# dot characters.
|
2167
2237
|
# @param new_type [String] How the dialog node is processed.
|
2168
2238
|
# @param new_event_name [String] How an `event_handler` node is processed.
|
2169
2239
|
# @param new_variable [String] The location in the dialog context where output is stored.
|
@@ -2172,7 +2242,8 @@ module IBMWatson
|
|
2172
2242
|
# @param new_digress_out [String] Whether this dialog node can be returned to after a digression.
|
2173
2243
|
# @param new_digress_out_slots [String] Whether the user can digress to top-level nodes while filling out slots.
|
2174
2244
|
# @param new_user_label [String] A label that can be displayed externally to describe the purpose of the node to
|
2175
|
-
# users.
|
2245
|
+
# users. If set, this label is used to identify the node in disambiguation responses
|
2246
|
+
# (overriding the value of the **title** property).
|
2176
2247
|
# @param new_disambiguation_opt_out [Boolean] Whether the dialog node should be excluded from disambiguation suggestions. Valid
|
2177
2248
|
# only when **type**=`standard` or `frame`.
|
2178
2249
|
# @param include_audit [Boolean] Whether to include the audit properties (`created` and `updated` timestamps) in
|
@@ -2235,7 +2306,7 @@ module IBMWatson
|
|
2235
2306
|
# Delete dialog node.
|
2236
2307
|
# Delete a dialog node from a workspace.
|
2237
2308
|
# @param workspace_id [String] Unique identifier of the workspace.
|
2238
|
-
# @param dialog_node [String] The dialog node ID (for example, `
|
2309
|
+
# @param dialog_node [String] The dialog node ID (for example, `node_1_1479323581900`).
|
2239
2310
|
# @return [nil]
|
2240
2311
|
def delete_dialog_node(workspace_id:, dialog_node:)
|
2241
2312
|
raise ArgumentError.new("workspace_id must be provided") if workspace_id.nil?
|
@@ -2272,6 +2343,8 @@ module IBMWatson
|
|
2272
2343
|
# @!method list_logs(workspace_id:, sort: nil, filter: nil, page_limit: nil, cursor: nil)
|
2273
2344
|
# List log events in a workspace.
|
2274
2345
|
# List the events from the log of a specific workspace.
|
2346
|
+
#
|
2347
|
+
# This method requires Manager access.
|
2275
2348
|
# @param workspace_id [String] Unique identifier of the workspace.
|
2276
2349
|
# @param sort [String] How to sort the returned log events. You can sort by **request_timestamp**. To
|
2277
2350
|
# reverse the sort order, prefix the parameter value with a minus sign (`-`).
|
@@ -2368,6 +2441,12 @@ module IBMWatson
|
|
2368
2441
|
# with a request that passes data. For more information about personal data and
|
2369
2442
|
# customer IDs, see [Information
|
2370
2443
|
# security](https://cloud.ibm.com/docs/assistant?topic=assistant-information-security#information-security).
|
2444
|
+
#
|
2445
|
+
# **Note:** This operation is intended only for deleting data associated with a
|
2446
|
+
# single specific customer, not for deleting data associated with multiple customers
|
2447
|
+
# or for any other purpose. For more information, see [Labeling and deleting data in
|
2448
|
+
# Watson
|
2449
|
+
# Assistant](https://cloud.ibm.com/docs/assistant?topic=assistant-information-security#information-security-gdpr-wa).
|
2371
2450
|
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
2372
2451
|
# @return [nil]
|
2373
2452
|
def delete_user_data(customer_id:)
|
@@ -2396,50 +2475,5 @@ module IBMWatson
|
|
2396
2475
|
)
|
2397
2476
|
nil
|
2398
2477
|
end
|
2399
|
-
#########################
|
2400
|
-
# bulkClassify
|
2401
|
-
#########################
|
2402
|
-
|
2403
|
-
##
|
2404
|
-
# @!method bulk_classify(workspace_id:, input: nil)
|
2405
|
-
# Identify intents and entities in multiple user utterances.
|
2406
|
-
# Send multiple user inputs to a workspace in a single request and receive
|
2407
|
-
# information about the intents and entities recognized in each input. This method
|
2408
|
-
# is useful for testing and comparing the performance of different workspaces.
|
2409
|
-
#
|
2410
|
-
# This method is available only with Premium plans.
|
2411
|
-
# @param workspace_id [String] Unique identifier of the workspace.
|
2412
|
-
# @param input [Array[BulkClassifyUtterance]] An array of input utterances to classify.
|
2413
|
-
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
2414
|
-
def bulk_classify(workspace_id:, input: nil)
|
2415
|
-
raise ArgumentError.new("workspace_id must be provided") if workspace_id.nil?
|
2416
|
-
|
2417
|
-
raise ArgumentError.new("version must be provided") if version.nil?
|
2418
|
-
|
2419
|
-
headers = {
|
2420
|
-
}
|
2421
|
-
sdk_headers = Common.new.get_sdk_headers("conversation", "V1", "bulk_classify")
|
2422
|
-
headers.merge!(sdk_headers)
|
2423
|
-
|
2424
|
-
params = {
|
2425
|
-
"version" => @version
|
2426
|
-
}
|
2427
|
-
|
2428
|
-
data = {
|
2429
|
-
"input" => input
|
2430
|
-
}
|
2431
|
-
|
2432
|
-
method_url = "/v1/workspaces/%s/bulk_classify" % [ERB::Util.url_encode(workspace_id)]
|
2433
|
-
|
2434
|
-
response = request(
|
2435
|
-
method: "POST",
|
2436
|
-
url: method_url,
|
2437
|
-
headers: headers,
|
2438
|
-
params: params,
|
2439
|
-
json: data,
|
2440
|
-
accept_json: true
|
2441
|
-
)
|
2442
|
-
response
|
2443
|
-
end
|
2444
2478
|
end
|
2445
2479
|
end
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
|
-
# IBM OpenAPI SDK Code Generator Version: 3.
|
17
|
+
# IBM OpenAPI SDK Code Generator Version: 3.31.0-902c9336-20210504-161156
|
18
18
|
#
|
19
19
|
# The IBM Watson™ Assistant service combines machine learning, natural language
|
20
20
|
# understanding, and an integrated dialog editor to create conversation flows between your
|
@@ -29,7 +29,6 @@ require "json"
|
|
29
29
|
require "ibm_cloud_sdk_core"
|
30
30
|
require_relative "./common.rb"
|
31
31
|
|
32
|
-
# Module for the Watson APIs
|
33
32
|
module IBMWatson
|
34
33
|
##
|
35
34
|
# The Assistant V2 service.
|
@@ -44,7 +43,7 @@ module IBMWatson
|
|
44
43
|
#
|
45
44
|
# @param args [Hash] The args to initialize with
|
46
45
|
# @option args version [String] Release date of the API version you want to use. Specify dates in YYYY-MM-DD
|
47
|
-
# format. The current version is `2020-
|
46
|
+
# format. The current version is `2020-09-24`.
|
48
47
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
49
48
|
# The base service_url may differ between IBM Cloud regions.
|
50
49
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
@@ -158,7 +157,7 @@ module IBMWatson
|
|
158
157
|
#########################
|
159
158
|
|
160
159
|
##
|
161
|
-
# @!method message(assistant_id:, session_id:, input: nil, context: nil)
|
160
|
+
# @!method message(assistant_id:, session_id:, input: nil, context: nil, user_id: nil)
|
162
161
|
# Send user input to assistant (stateful).
|
163
162
|
# Send user input to an assistant and receive a response, with conversation state
|
164
163
|
# (including context data) stored by Watson Assistant for the duration of the
|
@@ -177,8 +176,18 @@ module IBMWatson
|
|
177
176
|
#
|
178
177
|
# **Note:** The total size of the context data stored for a stateful session cannot
|
179
178
|
# exceed 100KB.
|
179
|
+
# @param user_id [String] A string value that identifies the user who is interacting with the assistant. The
|
180
|
+
# client must provide a unique identifier for each individual end user who accesses
|
181
|
+
# the application. For user-based plans, this user ID is used to identify unique
|
182
|
+
# users for billing purposes. This string cannot contain carriage return, newline,
|
183
|
+
# or tab characters. If no value is specified in the input, **user_id** is
|
184
|
+
# automatically set to the value of **context.global.session_id**.
|
185
|
+
#
|
186
|
+
# **Note:** This property is the same as the **user_id** property in the global
|
187
|
+
# system context. If **user_id** is specified in both locations, the value specified
|
188
|
+
# at the root is used.
|
180
189
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
181
|
-
def message(assistant_id:, session_id:, input: nil, context: nil)
|
190
|
+
def message(assistant_id:, session_id:, input: nil, context: nil, user_id: nil)
|
182
191
|
raise ArgumentError.new("assistant_id must be provided") if assistant_id.nil?
|
183
192
|
|
184
193
|
raise ArgumentError.new("session_id must be provided") if session_id.nil?
|
@@ -196,7 +205,8 @@ module IBMWatson
|
|
196
205
|
|
197
206
|
data = {
|
198
207
|
"input" => input,
|
199
|
-
"context" => context
|
208
|
+
"context" => context,
|
209
|
+
"user_id" => user_id
|
200
210
|
}
|
201
211
|
|
202
212
|
method_url = "/v2/assistants/%s/sessions/%s/message" % [ERB::Util.url_encode(assistant_id), ERB::Util.url_encode(session_id)]
|
@@ -213,7 +223,7 @@ module IBMWatson
|
|
213
223
|
end
|
214
224
|
|
215
225
|
##
|
216
|
-
# @!method message_stateless(assistant_id:, input: nil, context: nil)
|
226
|
+
# @!method message_stateless(assistant_id:, input: nil, context: nil, user_id: nil)
|
217
227
|
# Send user input to assistant (stateless).
|
218
228
|
# Send user input to an assistant and receive a response, with conversation state
|
219
229
|
# (including context data) managed by your application.
|
@@ -231,8 +241,18 @@ module IBMWatson
|
|
231
241
|
#
|
232
242
|
# **Note:** The total size of the context data for a stateless session cannot exceed
|
233
243
|
# 250KB.
|
244
|
+
# @param user_id [String] A string value that identifies the user who is interacting with the assistant. The
|
245
|
+
# client must provide a unique identifier for each individual end user who accesses
|
246
|
+
# the application. For user-based plans, this user ID is used to identify unique
|
247
|
+
# users for billing purposes. This string cannot contain carriage return, newline,
|
248
|
+
# or tab characters. If no value is specified in the input, **user_id** is
|
249
|
+
# automatically set to the value of **context.global.session_id**.
|
250
|
+
#
|
251
|
+
# **Note:** This property is the same as the **user_id** property in the global
|
252
|
+
# system context. If **user_id** is specified in both locations in a message
|
253
|
+
# request, the value specified at the root is used.
|
234
254
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
235
|
-
def message_stateless(assistant_id:, input: nil, context: nil)
|
255
|
+
def message_stateless(assistant_id:, input: nil, context: nil, user_id: nil)
|
236
256
|
raise ArgumentError.new("assistant_id must be provided") if assistant_id.nil?
|
237
257
|
|
238
258
|
raise ArgumentError.new("version must be provided") if version.nil?
|
@@ -248,7 +268,8 @@ module IBMWatson
|
|
248
268
|
|
249
269
|
data = {
|
250
270
|
"input" => input,
|
251
|
-
"context" => context
|
271
|
+
"context" => context,
|
272
|
+
"user_id" => user_id
|
252
273
|
}
|
253
274
|
|
254
275
|
method_url = "/v2/assistants/%s/message" % [ERB::Util.url_encode(assistant_id)]
|
@@ -264,6 +285,53 @@ module IBMWatson
|
|
264
285
|
response
|
265
286
|
end
|
266
287
|
#########################
|
288
|
+
# Bulk classify
|
289
|
+
#########################
|
290
|
+
|
291
|
+
##
|
292
|
+
# @!method bulk_classify(skill_id:, input: nil)
|
293
|
+
# Identify intents and entities in multiple user utterances.
|
294
|
+
# Send multiple user inputs to a dialog skill in a single request and receive
|
295
|
+
# information about the intents and entities recognized in each input. This method
|
296
|
+
# is useful for testing and comparing the performance of different skills or skill
|
297
|
+
# versions.
|
298
|
+
#
|
299
|
+
# This method is available only with Enterprise with Data Isolation plans.
|
300
|
+
# @param skill_id [String] Unique identifier of the skill. To find the skill ID in the Watson Assistant user
|
301
|
+
# interface, open the skill settings and click **API Details**.
|
302
|
+
# @param input [Array[BulkClassifyUtterance]] An array of input utterances to classify.
|
303
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
304
|
+
def bulk_classify(skill_id:, input: nil)
|
305
|
+
raise ArgumentError.new("skill_id must be provided") if skill_id.nil?
|
306
|
+
|
307
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
308
|
+
|
309
|
+
headers = {
|
310
|
+
}
|
311
|
+
sdk_headers = Common.new.get_sdk_headers("conversation", "V2", "bulk_classify")
|
312
|
+
headers.merge!(sdk_headers)
|
313
|
+
|
314
|
+
params = {
|
315
|
+
"version" => @version
|
316
|
+
}
|
317
|
+
|
318
|
+
data = {
|
319
|
+
"input" => input
|
320
|
+
}
|
321
|
+
|
322
|
+
method_url = "/v2/skills/%s/workspace/bulk_classify" % [ERB::Util.url_encode(skill_id)]
|
323
|
+
|
324
|
+
response = request(
|
325
|
+
method: "POST",
|
326
|
+
url: method_url,
|
327
|
+
headers: headers,
|
328
|
+
params: params,
|
329
|
+
json: data,
|
330
|
+
accept_json: true
|
331
|
+
)
|
332
|
+
response
|
333
|
+
end
|
334
|
+
#########################
|
267
335
|
# Logs
|
268
336
|
#########################
|
269
337
|
|
@@ -272,7 +340,7 @@ module IBMWatson
|
|
272
340
|
# List log events for an assistant.
|
273
341
|
# List the events from the log of an assistant.
|
274
342
|
#
|
275
|
-
# This method is available only with
|
343
|
+
# This method requires Manager access, and is available only with Enterprise plans.
|
276
344
|
# @param assistant_id [String] Unique identifier of the assistant. To find the assistant ID in the Watson
|
277
345
|
# Assistant user interface, open the assistant settings and click **API Details**.
|
278
346
|
# For information about creating assistants, see the
|
@@ -331,8 +399,11 @@ module IBMWatson
|
|
331
399
|
# customer IDs, see [Information
|
332
400
|
# security](https://cloud.ibm.com/docs/assistant?topic=assistant-information-security#information-security).
|
333
401
|
#
|
334
|
-
# This operation is
|
335
|
-
#
|
402
|
+
# **Note:** This operation is intended only for deleting data associated with a
|
403
|
+
# single specific customer, not for deleting data associated with multiple customers
|
404
|
+
# or for any other purpose. For more information, see [Labeling and deleting data in
|
405
|
+
# Watson
|
406
|
+
# Assistant](https://cloud.ibm.com/docs/assistant?topic=assistant-information-security#information-security-gdpr-wa).
|
336
407
|
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
337
408
|
# @return [nil]
|
338
409
|
def delete_user_data(customer_id:)
|
@@ -361,52 +432,5 @@ module IBMWatson
|
|
361
432
|
)
|
362
433
|
nil
|
363
434
|
end
|
364
|
-
#########################
|
365
|
-
# bulkClassify
|
366
|
-
#########################
|
367
|
-
|
368
|
-
##
|
369
|
-
# @!method bulk_classify(skill_id:, input: nil)
|
370
|
-
# Identify intents and entities in multiple user utterances.
|
371
|
-
# Send multiple user inputs to a dialog skill in a single request and receive
|
372
|
-
# information about the intents and entities recognized in each input. This method
|
373
|
-
# is useful for testing and comparing the performance of different skills or skill
|
374
|
-
# versions.
|
375
|
-
#
|
376
|
-
# This method is available only with Premium plans.
|
377
|
-
# @param skill_id [String] Unique identifier of the skill. To find the skill ID in the Watson Assistant user
|
378
|
-
# interface, open the skill settings and click **API Details**.
|
379
|
-
# @param input [Array[BulkClassifyUtterance]] An array of input utterances to classify.
|
380
|
-
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
381
|
-
def bulk_classify(skill_id:, input: nil)
|
382
|
-
raise ArgumentError.new("skill_id must be provided") if skill_id.nil?
|
383
|
-
|
384
|
-
raise ArgumentError.new("version must be provided") if version.nil?
|
385
|
-
|
386
|
-
headers = {
|
387
|
-
}
|
388
|
-
sdk_headers = Common.new.get_sdk_headers("conversation", "V2", "bulk_classify")
|
389
|
-
headers.merge!(sdk_headers)
|
390
|
-
|
391
|
-
params = {
|
392
|
-
"version" => @version
|
393
|
-
}
|
394
|
-
|
395
|
-
data = {
|
396
|
-
"input" => input
|
397
|
-
}
|
398
|
-
|
399
|
-
method_url = "/v2/skills/%s/workspace/bulk_classify" % [ERB::Util.url_encode(skill_id)]
|
400
|
-
|
401
|
-
response = request(
|
402
|
-
method: "POST",
|
403
|
-
url: method_url,
|
404
|
-
headers: headers,
|
405
|
-
params: params,
|
406
|
-
json: data,
|
407
|
-
accept_json: true
|
408
|
-
)
|
409
|
-
response
|
410
|
-
end
|
411
435
|
end
|
412
436
|
end
|