ibm_watson 1.3.0 → 2.0.0.rc1
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 +4 -4
- data/README.md +33 -5
- data/lib/ibm_watson/assistant_v1.rb +225 -199
- data/lib/ibm_watson/assistant_v2.rb +228 -21
- data/lib/ibm_watson/compare_comply_v1.rb +43 -24
- data/lib/ibm_watson/discovery_v1.rb +144 -19
- data/lib/ibm_watson/discovery_v2.rb +742 -23
- data/lib/ibm_watson/language_translator_v3.rb +216 -64
- data/lib/ibm_watson/natural_language_classifier_v1.rb +11 -3
- data/lib/ibm_watson/natural_language_understanding_v1.rb +32 -26
- data/lib/ibm_watson/personality_insights_v3.rb +22 -14
- data/lib/ibm_watson/speech_to_text_v1.rb +240 -106
- data/lib/ibm_watson/text_to_speech_v1.rb +139 -146
- data/lib/ibm_watson/tone_analyzer_v3.rb +19 -14
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v3.rb +31 -14
- data/lib/ibm_watson/visual_recognition_v4.rb +112 -22
- data/test/integration/test_assistant_v1.rb +9 -0
- data/test/integration/test_assistant_v2.rb +34 -0
- data/test/integration/test_compare_comply_v1.rb +1 -12
- data/test/integration/test_discovery_v2.rb +118 -6
- data/test/integration/test_language_translator_v3.rb +5 -0
- data/test/integration/test_speech_to_text_v1.rb +2 -0
- data/test/integration/test_text_to_speech_v1.rb +3 -3
- data/test/integration/test_visual_recognition_v4.rb +9 -0
- data/test/unit/test_assistant_v1.rb +149 -98
- data/test/unit/test_assistant_v2.rb +153 -8
- data/test/unit/test_compare_comply_v1.rb +20 -20
- data/test/unit/test_discovery_v1.rb +125 -125
- data/test/unit/test_discovery_v2.rb +262 -29
- data/test/unit/test_language_translator_v3.rb +85 -24
- data/test/unit/test_natural_language_classifier_v1.rb +17 -17
- data/test/unit/test_natural_language_understanding_v1.rb +10 -10
- data/test/unit/test_personality_insights_v3.rb +14 -14
- data/test/unit/test_speech_to_text_v1.rb +97 -97
- data/test/unit/test_text_to_speech_v1.rb +48 -48
- data/test/unit/test_tone_analyzer_v3.rb +12 -12
- data/test/unit/test_visual_recognition_v3.rb +16 -16
- data/test/unit/test_visual_recognition_v4.rb +56 -38
- metadata +5 -5
@@ -13,7 +13,9 @@
|
|
13
13
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
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.0-8d569e8f-20201030-142059
|
18
|
+
#
|
17
19
|
# The IBM Watson™ Tone Analyzer service uses linguistic analysis to detect
|
18
20
|
# emotional and language tones in written text. The service can analyze tone at both the
|
19
21
|
# document and sentence levels. You can use the service to understand how your written
|
@@ -38,37 +40,36 @@ module IBMWatson
|
|
38
40
|
# The Tone Analyzer V3 service.
|
39
41
|
class ToneAnalyzerV3 < IBMCloudSdkCore::BaseService
|
40
42
|
include Concurrent::Async
|
43
|
+
DEFAULT_SERVICE_NAME = "tone_analyzer"
|
44
|
+
DEFAULT_SERVICE_URL = "https://api.us-south.tone-analyzer.watson.cloud.ibm.com"
|
45
|
+
attr_accessor :version
|
41
46
|
##
|
42
47
|
# @!method initialize(args)
|
43
48
|
# Construct a new client for the Tone Analyzer service.
|
44
49
|
#
|
45
50
|
# @param args [Hash] The args to initialize with
|
46
|
-
# @option args version [String]
|
47
|
-
#
|
48
|
-
# incompatible way, a new minor version of the API is released.
|
49
|
-
# The service uses the API version for the date you specify, or
|
50
|
-
# the most recent version before that date. Note that you should
|
51
|
-
# not programmatically specify the current date at runtime, in
|
52
|
-
# case the API has been updated since your application's release.
|
53
|
-
# Instead, specify a version date that is compatible with your
|
54
|
-
# application, and don't change it until your application is
|
55
|
-
# ready for a later version.
|
51
|
+
# @option args version [String] Release date of the version of the API you want to use. Specify dates in
|
52
|
+
# YYYY-MM-DD format. The current version is `2017-09-21`.
|
56
53
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
57
54
|
# The base service_url may differ between IBM Cloud regions.
|
58
55
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
56
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
57
|
+
# any external configuration, if applicable.
|
59
58
|
def initialize(args = {})
|
60
59
|
@__async_initialized__ = false
|
61
60
|
defaults = {}
|
62
|
-
defaults[:
|
63
|
-
defaults[:
|
61
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
62
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
64
63
|
defaults[:authenticator] = nil
|
64
|
+
defaults[:version] = nil
|
65
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
65
66
|
args = defaults.merge(args)
|
66
67
|
@version = args[:version]
|
67
68
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
68
69
|
|
69
|
-
args[:service_name] = "tone_analyzer"
|
70
70
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
71
71
|
super
|
72
|
+
@service_url = user_service_url unless user_service_url.nil?
|
72
73
|
end
|
73
74
|
|
74
75
|
#########################
|
@@ -125,6 +126,8 @@ module IBMWatson
|
|
125
126
|
# **Accept-Language**.
|
126
127
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
127
128
|
def tone(tone_input:, content_type: nil, sentences: nil, tones: nil, content_language: nil, accept_language: nil)
|
129
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
130
|
+
|
128
131
|
raise ArgumentError.new("tone_input must be provided") if tone_input.nil?
|
129
132
|
|
130
133
|
headers = {
|
@@ -193,6 +196,8 @@ module IBMWatson
|
|
193
196
|
# **Accept-Language**.
|
194
197
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
195
198
|
def tone_chat(utterances:, content_language: nil, accept_language: nil)
|
199
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
200
|
+
|
196
201
|
raise ArgumentError.new("utterances must be provided") if utterances.nil?
|
197
202
|
|
198
203
|
headers = {
|
data/lib/ibm_watson/version.rb
CHANGED
@@ -13,7 +13,9 @@
|
|
13
13
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
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.0-8d569e8f-20201030-142059
|
18
|
+
#
|
17
19
|
# The IBM Watson™ Visual Recognition service uses deep learning algorithms to
|
18
20
|
# identify scenes and objects in images that you upload to the service. You can create and
|
19
21
|
# train a custom classifier to identify subjects that suit your needs.
|
@@ -30,37 +32,36 @@ module IBMWatson
|
|
30
32
|
# The Visual Recognition V3 service.
|
31
33
|
class VisualRecognitionV3 < IBMCloudSdkCore::BaseService
|
32
34
|
include Concurrent::Async
|
35
|
+
DEFAULT_SERVICE_NAME = "visual_recognition"
|
36
|
+
DEFAULT_SERVICE_URL = "https://api.us-south.visual-recognition.watson.cloud.ibm.com"
|
37
|
+
attr_accessor :version
|
33
38
|
##
|
34
39
|
# @!method initialize(args)
|
35
40
|
# Construct a new client for the Visual Recognition service.
|
36
41
|
#
|
37
42
|
# @param args [Hash] The args to initialize with
|
38
|
-
# @option args version [String]
|
39
|
-
#
|
40
|
-
# incompatible way, a new minor version of the API is released.
|
41
|
-
# The service uses the API version for the date you specify, or
|
42
|
-
# the most recent version before that date. Note that you should
|
43
|
-
# not programmatically specify the current date at runtime, in
|
44
|
-
# case the API has been updated since your application's release.
|
45
|
-
# Instead, specify a version date that is compatible with your
|
46
|
-
# application, and don't change it until your application is
|
47
|
-
# ready for a later version.
|
43
|
+
# @option args version [String] Release date of the API version you want to use. Specify dates in YYYY-MM-DD
|
44
|
+
# format. The current version is `2018-03-19`.
|
48
45
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
49
46
|
# The base service_url may differ between IBM Cloud regions.
|
50
47
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
48
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
49
|
+
# any external configuration, if applicable.
|
51
50
|
def initialize(args = {})
|
52
51
|
@__async_initialized__ = false
|
53
52
|
defaults = {}
|
54
|
-
defaults[:
|
55
|
-
defaults[:
|
53
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
54
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
56
55
|
defaults[:authenticator] = nil
|
56
|
+
defaults[:version] = nil
|
57
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
57
58
|
args = defaults.merge(args)
|
58
59
|
@version = args[:version]
|
59
60
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
60
61
|
|
61
|
-
args[:service_name] = "visual_recognition"
|
62
62
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
63
63
|
super
|
64
|
+
@service_url = user_service_url unless user_service_url.nil?
|
64
65
|
end
|
65
66
|
|
66
67
|
#########################
|
@@ -106,6 +107,8 @@ module IBMWatson
|
|
106
107
|
# @param accept_language [String] The desired language of parts of the response. See the response for details.
|
107
108
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
108
109
|
def classify(images_file: nil, images_filename: nil, images_file_content_type: nil, url: nil, threshold: nil, owners: nil, classifier_ids: nil, accept_language: nil)
|
110
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
111
|
+
|
109
112
|
headers = {
|
110
113
|
"Accept-Language" => accept_language
|
111
114
|
}
|
@@ -192,6 +195,8 @@ module IBMWatson
|
|
192
195
|
# @param negative_examples_filename [String] The filename for negative_examples.
|
193
196
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
194
197
|
def create_classifier(name:, positive_examples:, negative_examples: nil, negative_examples_filename: nil)
|
198
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
199
|
+
|
195
200
|
raise ArgumentError.new("name must be provided") if name.nil?
|
196
201
|
|
197
202
|
raise ArgumentError.new("positive_examples must be a hash") unless positive_examples.is_a?(Hash)
|
@@ -247,6 +252,8 @@ module IBMWatson
|
|
247
252
|
# return a brief list of classifiers.
|
248
253
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
249
254
|
def list_classifiers(verbose: nil)
|
255
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
256
|
+
|
250
257
|
headers = {
|
251
258
|
}
|
252
259
|
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V3", "list_classifiers")
|
@@ -276,6 +283,8 @@ module IBMWatson
|
|
276
283
|
# @param classifier_id [String] The ID of the classifier.
|
277
284
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
278
285
|
def get_classifier(classifier_id:)
|
286
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
287
|
+
|
279
288
|
raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
|
280
289
|
|
281
290
|
headers = {
|
@@ -344,6 +353,8 @@ module IBMWatson
|
|
344
353
|
# @param negative_examples_filename [String] The filename for negative_examples.
|
345
354
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
346
355
|
def update_classifier(classifier_id:, positive_examples: nil, negative_examples: nil, negative_examples_filename: nil)
|
356
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
357
|
+
|
347
358
|
raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
|
348
359
|
|
349
360
|
raise ArgumentError.new("positive_examples must be a hash") unless positive_examples.nil? || positive_examples.is_a?(Hash)
|
@@ -395,6 +406,8 @@ module IBMWatson
|
|
395
406
|
# @param classifier_id [String] The ID of the classifier.
|
396
407
|
# @return [nil]
|
397
408
|
def delete_classifier(classifier_id:)
|
409
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
410
|
+
|
398
411
|
raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
|
399
412
|
|
400
413
|
headers = {
|
@@ -429,6 +442,8 @@ module IBMWatson
|
|
429
442
|
# @param classifier_id [String] The ID of the classifier.
|
430
443
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
431
444
|
def get_core_ml_model(classifier_id:)
|
445
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
446
|
+
|
432
447
|
raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
|
433
448
|
|
434
449
|
headers = {
|
@@ -468,6 +483,8 @@ module IBMWatson
|
|
468
483
|
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
469
484
|
# @return [nil]
|
470
485
|
def delete_user_data(customer_id:)
|
486
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
487
|
+
|
471
488
|
raise ArgumentError.new("customer_id must be provided") if customer_id.nil?
|
472
489
|
|
473
490
|
headers = {
|
@@ -13,7 +13,9 @@
|
|
13
13
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
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.0-8d569e8f-20201030-142059
|
18
|
+
#
|
17
19
|
# Provide images to the IBM Watson™ Visual Recognition service for analysis. The
|
18
20
|
# service detects objects based on a set of images with training data.
|
19
21
|
|
@@ -29,37 +31,36 @@ module IBMWatson
|
|
29
31
|
# The Visual Recognition V4 service.
|
30
32
|
class VisualRecognitionV4 < IBMCloudSdkCore::BaseService
|
31
33
|
include Concurrent::Async
|
34
|
+
DEFAULT_SERVICE_NAME = "visual_recognition"
|
35
|
+
DEFAULT_SERVICE_URL = "https://api.us-south.visual-recognition.watson.cloud.ibm.com"
|
36
|
+
attr_accessor :version
|
32
37
|
##
|
33
38
|
# @!method initialize(args)
|
34
39
|
# Construct a new client for the Visual Recognition service.
|
35
40
|
#
|
36
41
|
# @param args [Hash] The args to initialize with
|
37
|
-
# @option args version [String]
|
38
|
-
#
|
39
|
-
# incompatible way, a new minor version of the API is released.
|
40
|
-
# The service uses the API version for the date you specify, or
|
41
|
-
# the most recent version before that date. Note that you should
|
42
|
-
# not programmatically specify the current date at runtime, in
|
43
|
-
# case the API has been updated since your application's release.
|
44
|
-
# Instead, specify a version date that is compatible with your
|
45
|
-
# application, and don't change it until your application is
|
46
|
-
# ready for a later version.
|
42
|
+
# @option args version [String] Release date of the API version you want to use. Specify dates in YYYY-MM-DD
|
43
|
+
# format. The current version is `2019-02-11`.
|
47
44
|
# @option args service_url [String] The base service URL to use when contacting the service.
|
48
45
|
# The base service_url may differ between IBM Cloud regions.
|
49
46
|
# @option args authenticator [Object] The Authenticator instance to be configured for this service.
|
47
|
+
# @option args service_name [String] The name of the service to configure. Will be used as the key to load
|
48
|
+
# any external configuration, if applicable.
|
50
49
|
def initialize(args = {})
|
51
50
|
@__async_initialized__ = false
|
52
51
|
defaults = {}
|
53
|
-
defaults[:
|
54
|
-
defaults[:
|
52
|
+
defaults[:service_url] = DEFAULT_SERVICE_URL
|
53
|
+
defaults[:service_name] = DEFAULT_SERVICE_NAME
|
55
54
|
defaults[:authenticator] = nil
|
55
|
+
defaults[:version] = nil
|
56
|
+
user_service_url = args[:service_url] unless args[:service_url].nil?
|
56
57
|
args = defaults.merge(args)
|
57
58
|
@version = args[:version]
|
58
59
|
raise ArgumentError.new("version must be provided") if @version.nil?
|
59
60
|
|
60
|
-
args[:service_name] = "visual_recognition"
|
61
61
|
args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil?
|
62
62
|
super
|
63
|
+
@service_url = user_service_url unless user_service_url.nil?
|
63
64
|
end
|
64
65
|
|
65
66
|
#########################
|
@@ -95,6 +96,8 @@ module IBMWatson
|
|
95
96
|
# @param threshold [Float] The minimum score a feature must have to be returned.
|
96
97
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
97
98
|
def analyze(collection_ids:, features:, images_file: nil, image_url: nil, threshold: nil)
|
99
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
100
|
+
|
98
101
|
raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil?
|
99
102
|
|
100
103
|
raise ArgumentError.new("features must be provided") if features.nil?
|
@@ -150,7 +153,7 @@ module IBMWatson
|
|
150
153
|
#########################
|
151
154
|
|
152
155
|
##
|
153
|
-
# @!method create_collection(name: nil, description: nil)
|
156
|
+
# @!method create_collection(name: nil, description: nil, training_status: nil)
|
154
157
|
# Create a collection.
|
155
158
|
# Create a collection that can be used to store images.
|
156
159
|
#
|
@@ -162,8 +165,11 @@ module IBMWatson
|
|
162
165
|
# @param name [String] The name of the collection. The name can contain alphanumeric, underscore, hyphen,
|
163
166
|
# and dot characters. It cannot begin with the reserved prefix `sys-`.
|
164
167
|
# @param description [String] The description of the collection.
|
168
|
+
# @param training_status [TrainingStatus] Training status information for the collection.
|
165
169
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
166
|
-
def create_collection(name: nil, description: nil)
|
170
|
+
def create_collection(name: nil, description: nil, training_status: nil)
|
171
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
172
|
+
|
167
173
|
headers = {
|
168
174
|
}
|
169
175
|
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "create_collection")
|
@@ -175,7 +181,8 @@ module IBMWatson
|
|
175
181
|
|
176
182
|
data = {
|
177
183
|
"name" => name,
|
178
|
-
"description" => description
|
184
|
+
"description" => description,
|
185
|
+
"training_status" => training_status
|
179
186
|
}
|
180
187
|
|
181
188
|
method_url = "/v4/collections"
|
@@ -197,6 +204,8 @@ module IBMWatson
|
|
197
204
|
# Retrieves a list of collections for the service instance.
|
198
205
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
199
206
|
def list_collections
|
207
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
208
|
+
|
200
209
|
headers = {
|
201
210
|
}
|
202
211
|
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "list_collections")
|
@@ -225,6 +234,8 @@ module IBMWatson
|
|
225
234
|
# @param collection_id [String] The identifier of the collection.
|
226
235
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
227
236
|
def get_collection(collection_id:)
|
237
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
238
|
+
|
228
239
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
229
240
|
|
230
241
|
headers = {
|
@@ -249,7 +260,7 @@ module IBMWatson
|
|
249
260
|
end
|
250
261
|
|
251
262
|
##
|
252
|
-
# @!method update_collection(collection_id:, name: nil, description: nil)
|
263
|
+
# @!method update_collection(collection_id:, name: nil, description: nil, training_status: nil)
|
253
264
|
# Update a collection.
|
254
265
|
# Update the name or description of a collection.
|
255
266
|
#
|
@@ -259,8 +270,11 @@ module IBMWatson
|
|
259
270
|
# @param name [String] The name of the collection. The name can contain alphanumeric, underscore, hyphen,
|
260
271
|
# and dot characters. It cannot begin with the reserved prefix `sys-`.
|
261
272
|
# @param description [String] The description of the collection.
|
273
|
+
# @param training_status [TrainingStatus] Training status information for the collection.
|
262
274
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
263
|
-
def update_collection(collection_id:, name: nil, description: nil)
|
275
|
+
def update_collection(collection_id:, name: nil, description: nil, training_status: nil)
|
276
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
277
|
+
|
264
278
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
265
279
|
|
266
280
|
headers = {
|
@@ -274,7 +288,8 @@ module IBMWatson
|
|
274
288
|
|
275
289
|
data = {
|
276
290
|
"name" => name,
|
277
|
-
"description" => description
|
291
|
+
"description" => description,
|
292
|
+
"training_status" => training_status
|
278
293
|
}
|
279
294
|
|
280
295
|
method_url = "/v4/collections/%s" % [ERB::Util.url_encode(collection_id)]
|
@@ -297,6 +312,8 @@ module IBMWatson
|
|
297
312
|
# @param collection_id [String] The identifier of the collection.
|
298
313
|
# @return [nil]
|
299
314
|
def delete_collection(collection_id:)
|
315
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
316
|
+
|
300
317
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
301
318
|
|
302
319
|
headers = {
|
@@ -319,6 +336,53 @@ module IBMWatson
|
|
319
336
|
)
|
320
337
|
nil
|
321
338
|
end
|
339
|
+
|
340
|
+
##
|
341
|
+
# @!method get_model_file(collection_id:, feature:, model_format:)
|
342
|
+
# Get a model.
|
343
|
+
# Download a model that you can deploy to detect objects in images. The collection
|
344
|
+
# must include a generated model, which is indicated in the response for the
|
345
|
+
# collection details as `"rscnn_ready": true`. If the value is `false`, train or
|
346
|
+
# retrain the collection to generate the model.
|
347
|
+
#
|
348
|
+
# Currently, the model format is specific to Android apps. For more information
|
349
|
+
# about how to deploy the model to your app, see the [Watson Visual Recognition on
|
350
|
+
# Android](https://github.com/matt-ny/rscnn) project in GitHub.
|
351
|
+
# @param collection_id [String] The identifier of the collection.
|
352
|
+
# @param feature [String] The feature for the model.
|
353
|
+
# @param model_format [String] The format of the returned model.
|
354
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
355
|
+
def get_model_file(collection_id:, feature:, model_format:)
|
356
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
357
|
+
|
358
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
359
|
+
|
360
|
+
raise ArgumentError.new("feature must be provided") if feature.nil?
|
361
|
+
|
362
|
+
raise ArgumentError.new("model_format must be provided") if model_format.nil?
|
363
|
+
|
364
|
+
headers = {
|
365
|
+
}
|
366
|
+
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "get_model_file")
|
367
|
+
headers.merge!(sdk_headers)
|
368
|
+
|
369
|
+
params = {
|
370
|
+
"version" => @version,
|
371
|
+
"feature" => feature,
|
372
|
+
"model_format" => model_format
|
373
|
+
}
|
374
|
+
|
375
|
+
method_url = "/v4/collections/%s/model" % [ERB::Util.url_encode(collection_id)]
|
376
|
+
|
377
|
+
response = request(
|
378
|
+
method: "GET",
|
379
|
+
url: method_url,
|
380
|
+
headers: headers,
|
381
|
+
params: params,
|
382
|
+
accept_json: false
|
383
|
+
)
|
384
|
+
response
|
385
|
+
end
|
322
386
|
#########################
|
323
387
|
# Images
|
324
388
|
#########################
|
@@ -354,6 +418,8 @@ module IBMWatson
|
|
354
418
|
# than 32 characters.
|
355
419
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
356
420
|
def add_images(collection_id:, images_file: nil, image_url: nil, training_data: nil)
|
421
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
422
|
+
|
357
423
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
358
424
|
|
359
425
|
headers = {
|
@@ -403,6 +469,8 @@ module IBMWatson
|
|
403
469
|
# @param collection_id [String] The identifier of the collection.
|
404
470
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
405
471
|
def list_images(collection_id:)
|
472
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
473
|
+
|
406
474
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
407
475
|
|
408
476
|
headers = {
|
@@ -434,6 +502,8 @@ module IBMWatson
|
|
434
502
|
# @param image_id [String] The identifier of the image.
|
435
503
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
436
504
|
def get_image_details(collection_id:, image_id:)
|
505
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
506
|
+
|
437
507
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
438
508
|
|
439
509
|
raise ArgumentError.new("image_id must be provided") if image_id.nil?
|
@@ -467,6 +537,8 @@ module IBMWatson
|
|
467
537
|
# @param image_id [String] The identifier of the image.
|
468
538
|
# @return [nil]
|
469
539
|
def delete_image(collection_id:, image_id:)
|
540
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
541
|
+
|
470
542
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
471
543
|
|
472
544
|
raise ArgumentError.new("image_id must be provided") if image_id.nil?
|
@@ -503,6 +575,8 @@ module IBMWatson
|
|
503
575
|
# For example, an original 800 x 1000 image is resized to 160 x 200 pixels.
|
504
576
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
505
577
|
def get_jpeg_image(collection_id:, image_id:, size: nil)
|
578
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
579
|
+
|
506
580
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
507
581
|
|
508
582
|
raise ArgumentError.new("image_id must be provided") if image_id.nil?
|
@@ -539,6 +613,8 @@ module IBMWatson
|
|
539
613
|
# @param collection_id [String] The identifier of the collection.
|
540
614
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
541
615
|
def list_object_metadata(collection_id:)
|
616
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
617
|
+
|
542
618
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
543
619
|
|
544
620
|
headers = {
|
@@ -574,6 +650,8 @@ module IBMWatson
|
|
574
650
|
# `sys-`.
|
575
651
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
576
652
|
def update_object_metadata(collection_id:, object:, new_object:)
|
653
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
654
|
+
|
577
655
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
578
656
|
|
579
657
|
raise ArgumentError.new("object must be provided") if object.nil?
|
@@ -614,6 +692,8 @@ module IBMWatson
|
|
614
692
|
# @param object [String] The name of the object.
|
615
693
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
616
694
|
def get_object_metadata(collection_id:, object:)
|
695
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
696
|
+
|
617
697
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
618
698
|
|
619
699
|
raise ArgumentError.new("object must be provided") if object.nil?
|
@@ -648,6 +728,8 @@ module IBMWatson
|
|
648
728
|
# @param object [String] The name of the object.
|
649
729
|
# @return [nil]
|
650
730
|
def delete_object(collection_id:, object:)
|
731
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
732
|
+
|
651
733
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
652
734
|
|
653
735
|
raise ArgumentError.new("object must be provided") if object.nil?
|
@@ -685,6 +767,8 @@ module IBMWatson
|
|
685
767
|
# @param collection_id [String] The identifier of the collection.
|
686
768
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
687
769
|
def train(collection_id:)
|
770
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
771
|
+
|
688
772
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
689
773
|
|
690
774
|
headers = {
|
@@ -726,6 +810,8 @@ module IBMWatson
|
|
726
810
|
# @param objects [Array[TrainingDataObject]] Training data for specific objects.
|
727
811
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
728
812
|
def add_image_training_data(collection_id:, image_id:, objects: nil)
|
813
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
814
|
+
|
729
815
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
730
816
|
|
731
817
|
raise ArgumentError.new("image_id must be provided") if image_id.nil?
|
@@ -761,14 +847,16 @@ module IBMWatson
|
|
761
847
|
# Get training usage.
|
762
848
|
# Information about the completed training events. You can use this information to
|
763
849
|
# determine how close you are to the training limits for the month.
|
764
|
-
# @param start_time [
|
850
|
+
# @param start_time [Time] The earliest day to include training events. Specify dates in YYYY-MM-DD format.
|
765
851
|
# If empty or not specified, the earliest training event is included.
|
766
|
-
# @param end_time [
|
852
|
+
# @param end_time [Time] The most recent day to include training events. Specify dates in YYYY-MM-DD
|
767
853
|
# format. All events for the day are included. If empty or not specified, the
|
768
854
|
# current day is used. Specify the same value as `start_time` to request events for
|
769
855
|
# a single day.
|
770
856
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
771
857
|
def get_training_usage(start_time: nil, end_time: nil)
|
858
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
859
|
+
|
772
860
|
headers = {
|
773
861
|
}
|
774
862
|
sdk_headers = Common.new.get_sdk_headers("watson_vision_combined", "V4", "get_training_usage")
|
@@ -808,6 +896,8 @@ module IBMWatson
|
|
808
896
|
# @param customer_id [String] The customer ID for which all data is to be deleted.
|
809
897
|
# @return [nil]
|
810
898
|
def delete_user_data(customer_id:)
|
899
|
+
raise ArgumentError.new("version must be provided") if version.nil?
|
900
|
+
|
811
901
|
raise ArgumentError.new("customer_id must be provided") if customer_id.nil?
|
812
902
|
|
813
903
|
headers = {
|