ibm_watson 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ibm_watson/assistant_v1.rb +791 -736
  3. data/lib/ibm_watson/assistant_v2.rb +12 -8
  4. data/lib/ibm_watson/common.rb +2 -1
  5. data/lib/ibm_watson/compare_comply_v1.rb +171 -169
  6. data/lib/ibm_watson/discovery_v1.rb +778 -689
  7. data/lib/ibm_watson/language_translator_v3.rb +65 -63
  8. data/lib/ibm_watson/natural_language_classifier_v1.rb +36 -35
  9. data/lib/ibm_watson/natural_language_understanding_v1.rb +28 -25
  10. data/lib/ibm_watson/personality_insights_v3.rb +10 -10
  11. data/lib/ibm_watson/speech_to_text_v1.rb +764 -702
  12. data/lib/ibm_watson/text_to_speech_v1.rb +215 -200
  13. data/lib/ibm_watson/tone_analyzer_v3.rb +10 -9
  14. data/lib/ibm_watson/version.rb +1 -1
  15. data/lib/ibm_watson/visual_recognition_v3.rb +94 -95
  16. data/lib/ibm_watson/websocket/speech_to_text_websocket_listener.rb +1 -1
  17. data/test/integration/test_assistant_v1.rb +18 -289
  18. data/test/integration/test_assistant_v2.rb +21 -31
  19. data/test/integration/test_discovery_v1.rb +21 -18
  20. data/test/integration/test_language_translator_v3.rb +3 -3
  21. data/test/integration/test_natural_language_classifier_v1.rb +3 -3
  22. data/test/integration/test_natural_language_understanding_v1.rb +16 -20
  23. data/test/integration/test_personality_insights_v3.rb +12 -40
  24. data/test/integration/test_speech_to_text_v1.rb +3 -3
  25. data/test/integration/test_text_to_speech_v1.rb +3 -3
  26. data/test/integration/test_tone_analyzer_v3.rb +14 -31
  27. data/test/integration/test_visual_recognition_v3.rb +3 -3
  28. data/test/unit/test_compare_comply_v1.rb +3 -7
  29. data/test/unit/test_discovery_v1.rb +21 -7
  30. data/test/unit/test_language_translator_v3.rb +1 -3
  31. data/test/unit/test_natural_language_classifier_v1.rb +1 -3
  32. data/test/unit/test_speech_to_text_v1.rb +25 -7
  33. data/test/unit/test_text_to_speech_v1.rb +0 -4
  34. data/test/unit/test_visual_recognition_v3.rb +2 -6
  35. metadata +2 -2
@@ -23,7 +23,6 @@
23
23
  require "concurrent"
24
24
  require "erb"
25
25
  require "json"
26
-
27
26
  require "ibm_cloud_sdk_core"
28
27
  require_relative "./common.rb"
29
28
 
@@ -107,7 +106,8 @@ module IBMWatson
107
106
 
108
107
  headers = {
109
108
  }
110
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "translate")
109
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "translate")
110
+ headers.merge!(sdk_headers)
111
111
 
112
112
  params = {
113
113
  "version" => @version
@@ -136,33 +136,6 @@ module IBMWatson
136
136
  # Identification
137
137
  #########################
138
138
 
139
- ##
140
- # @!method list_identifiable_languages
141
- # List identifiable languages.
142
- # Lists the languages that the service can identify. Returns the language code (for
143
- # example, `en` for English or `es` for Spanish) and name of each language.
144
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
145
- def list_identifiable_languages
146
- headers = {
147
- }
148
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "list_identifiable_languages")
149
-
150
- params = {
151
- "version" => @version
152
- }
153
-
154
- method_url = "/v3/identifiable_languages"
155
-
156
- response = request(
157
- method: "GET",
158
- url: method_url,
159
- headers: headers,
160
- params: params,
161
- accept_json: true
162
- )
163
- response
164
- end
165
-
166
139
  ##
167
140
  # @!method identify(text:)
168
141
  # Identify language.
@@ -174,7 +147,8 @@ module IBMWatson
174
147
 
175
148
  headers = {
176
149
  }
177
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "identify")
150
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "identify")
151
+ headers.merge!(sdk_headers)
178
152
 
179
153
  params = {
180
154
  "version" => @version
@@ -195,34 +169,24 @@ module IBMWatson
195
169
  )
196
170
  response
197
171
  end
198
- #########################
199
- # Models
200
- #########################
201
172
 
202
173
  ##
203
- # @!method list_models(source: nil, target: nil, default_models: nil)
204
- # List models.
205
- # Lists available translation models.
206
- # @param source [String] Specify a language code to filter results by source language.
207
- # @param target [String] Specify a language code to filter results by target language.
208
- # @param default_models [Boolean] If the default parameter isn't specified, the service will return all models
209
- # (default and non-default) for each language pair. To return only default models,
210
- # set this to `true`. To return only non-default models, set this to `false`. There
211
- # is exactly one default model per language pair, the IBM provided base model.
174
+ # @!method list_identifiable_languages
175
+ # List identifiable languages.
176
+ # Lists the languages that the service can identify. Returns the language code (for
177
+ # example, `en` for English or `es` for Spanish) and name of each language.
212
178
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
213
- def list_models(source: nil, target: nil, default_models: nil)
179
+ def list_identifiable_languages
214
180
  headers = {
215
181
  }
216
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "list_models")
182
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "list_identifiable_languages")
183
+ headers.merge!(sdk_headers)
217
184
 
218
185
  params = {
219
- "version" => @version,
220
- "source" => source,
221
- "target" => target,
222
- "default" => default_models
186
+ "version" => @version
223
187
  }
224
188
 
225
- method_url = "/v3/models"
189
+ method_url = "/v3/identifiable_languages"
226
190
 
227
191
  response = request(
228
192
  method: "GET",
@@ -233,9 +197,12 @@ module IBMWatson
233
197
  )
234
198
  response
235
199
  end
200
+ #########################
201
+ # Models
202
+ #########################
236
203
 
237
204
  ##
238
- # @!method create_model(base_model_id:, name: nil, forced_glossary: nil, parallel_corpus: nil, forced_glossary_filename: nil, parallel_corpus_filename: nil)
205
+ # @!method create_model(base_model_id:, forced_glossary: nil, parallel_corpus: nil, name: nil)
239
206
  # Create model.
240
207
  # Uploads Translation Memory eXchange (TMX) files to customize a translation model.
241
208
  #
@@ -256,9 +223,6 @@ module IBMWatson
256
223
  # models, use the `List models` method. Usually all IBM provided models are
257
224
  # customizable. In addition, all your models that have been created via parallel
258
225
  # corpus customization, can be further customized with a forced glossary.
259
- # @param name [String] An optional model name that you can use to identify the model. Valid characters
260
- # are letters, numbers, dashes, underscores, spaces and apostrophes. The maximum
261
- # length is 32 characters.
262
226
  # @param forced_glossary [File] A TMX file with your customizations. The customizations in the file completely
263
227
  # overwrite the domain translaton data, including high frequency or high confidence
264
228
  # phrase translations. You can upload only one glossary with a file size less than
@@ -267,15 +231,17 @@ module IBMWatson
267
231
  # multiple parallel_corpus files in one request. All uploaded parallel_corpus files
268
232
  # combined, your parallel corpus must contain at least 5,000 parallel sentences to
269
233
  # train successfully.
270
- # @param forced_glossary_filename [String] The filename for forced_glossary.
271
- # @param parallel_corpus_filename [String] The filename for parallel_corpus.
234
+ # @param name [String] An optional model name that you can use to identify the model. Valid characters
235
+ # are letters, numbers, dashes, underscores, spaces and apostrophes. The maximum
236
+ # length is 32 characters.
272
237
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
273
- def create_model(base_model_id:, name: nil, forced_glossary: nil, parallel_corpus: nil, forced_glossary_filename: nil, parallel_corpus_filename: nil)
238
+ def create_model(base_model_id:, forced_glossary: nil, parallel_corpus: nil, name: nil)
274
239
  raise ArgumentError.new("base_model_id must be provided") if base_model_id.nil?
275
240
 
276
241
  headers = {
277
242
  }
278
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "create_model")
243
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "create_model")
244
+ headers.merge!(sdk_headers)
279
245
 
280
246
  params = {
281
247
  "version" => @version,
@@ -289,16 +255,14 @@ module IBMWatson
289
255
  unless forced_glossary.instance_of?(StringIO) || forced_glossary.instance_of?(File)
290
256
  forced_glossary = forced_glossary.respond_to?(:to_json) ? StringIO.new(forced_glossary.to_json) : StringIO.new(forced_glossary)
291
257
  end
292
- forced_glossary_filename = forced_glossary.path if forced_glossary_filename.nil? && forced_glossary.respond_to?(:path)
293
- form_data[:forced_glossary] = HTTP::FormData::File.new(forced_glossary, content_type: "application/octet-stream", filename: forced_glossary_filename)
258
+ form_data[:forced_glossary] = HTTP::FormData::File.new(forced_glossary, content_type: "application/octet-stream", filename: forced_glossary.respond_to?(:path) ? forced_glossary.path : nil)
294
259
  end
295
260
 
296
261
  unless parallel_corpus.nil?
297
262
  unless parallel_corpus.instance_of?(StringIO) || parallel_corpus.instance_of?(File)
298
263
  parallel_corpus = parallel_corpus.respond_to?(:to_json) ? StringIO.new(parallel_corpus.to_json) : StringIO.new(parallel_corpus)
299
264
  end
300
- parallel_corpus_filename = parallel_corpus.path if parallel_corpus_filename.nil? && parallel_corpus.respond_to?(:path)
301
- form_data[:parallel_corpus] = HTTP::FormData::File.new(parallel_corpus, content_type: "application/octet-stream", filename: parallel_corpus_filename)
265
+ form_data[:parallel_corpus] = HTTP::FormData::File.new(parallel_corpus, content_type: "application/octet-stream", filename: parallel_corpus.respond_to?(:path) ? parallel_corpus.path : nil)
302
266
  end
303
267
 
304
268
  method_url = "/v3/models"
@@ -325,7 +289,8 @@ module IBMWatson
325
289
 
326
290
  headers = {
327
291
  }
328
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "delete_model")
292
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "delete_model")
293
+ headers.merge!(sdk_headers)
329
294
 
330
295
  params = {
331
296
  "version" => @version
@@ -356,7 +321,8 @@ module IBMWatson
356
321
 
357
322
  headers = {
358
323
  }
359
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "language_translator", service_version: "V3", operation_id: "get_model")
324
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "get_model")
325
+ headers.merge!(sdk_headers)
360
326
 
361
327
  params = {
362
328
  "version" => @version
@@ -373,5 +339,41 @@ module IBMWatson
373
339
  )
374
340
  response
375
341
  end
342
+
343
+ ##
344
+ # @!method list_models(source: nil, target: nil, default_models: nil)
345
+ # List models.
346
+ # Lists available translation models.
347
+ # @param source [String] Specify a language code to filter results by source language.
348
+ # @param target [String] Specify a language code to filter results by target language.
349
+ # @param default_models [Boolean] If the default parameter isn't specified, the service will return all models
350
+ # (default and non-default) for each language pair. To return only default models,
351
+ # set this to `true`. To return only non-default models, set this to `false`. There
352
+ # is exactly one default model per language pair, the IBM provided base model.
353
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
354
+ def list_models(source: nil, target: nil, default_models: nil)
355
+ headers = {
356
+ }
357
+ sdk_headers = Common.new.get_sdk_headers("language_translator", "V3", "list_models")
358
+ headers.merge!(sdk_headers)
359
+
360
+ params = {
361
+ "version" => @version,
362
+ "source" => source,
363
+ "target" => target,
364
+ "default" => default_models
365
+ }
366
+
367
+ method_url = "/v3/models"
368
+
369
+ response = request(
370
+ method: "GET",
371
+ url: method_url,
372
+ headers: headers,
373
+ params: params,
374
+ accept_json: true
375
+ )
376
+ response
377
+ end
376
378
  end
377
379
  end
@@ -22,7 +22,6 @@
22
22
  require "concurrent"
23
23
  require "erb"
24
24
  require "json"
25
-
26
25
  require "ibm_cloud_sdk_core"
27
26
  require_relative "./common.rb"
28
27
 
@@ -93,7 +92,8 @@ module IBMWatson
93
92
 
94
93
  headers = {
95
94
  }
96
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "classify")
95
+ sdk_headers = Common.new.get_sdk_headers("natural_language_classifier", "V1", "classify")
96
+ headers.merge!(sdk_headers)
97
97
 
98
98
  data = {
99
99
  "text" => text
@@ -128,7 +128,8 @@ module IBMWatson
128
128
 
129
129
  headers = {
130
130
  }
131
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "classify_collection")
131
+ sdk_headers = Common.new.get_sdk_headers("natural_language_classifier", "V1", "classify_collection")
132
+ headers.merge!(sdk_headers)
132
133
 
133
134
  data = {
134
135
  "collection" => collection
@@ -150,7 +151,7 @@ module IBMWatson
150
151
  #########################
151
152
 
152
153
  ##
153
- # @!method create_classifier(metadata:, training_data:, metadata_filename: nil, training_data_filename: nil)
154
+ # @!method create_classifier(metadata:, training_data:)
154
155
  # Create classifier.
155
156
  # Sends data to create and train a classifier and returns information about the new
156
157
  # classifier.
@@ -164,31 +165,28 @@ module IBMWatson
164
165
  # @param training_data [File] Training data in CSV format. Each text value must have at least one class. The
165
166
  # data can include up to 3,000 classes and 20,000 records. For details, see [Data
166
167
  # preparation](https://cloud.ibm.com/docs/services/natural-language-classifier/using-your-data.html).
167
- # @param metadata_filename [String] The filename for training_metadata.
168
- # @param training_data_filename [String] The filename for training_data.
169
168
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
170
- def create_classifier(metadata:, training_data:, metadata_filename: nil, training_data_filename: nil)
169
+ def create_classifier(metadata:, training_data:)
171
170
  raise ArgumentError.new("metadata must be provided") if metadata.nil?
172
171
 
173
172
  raise ArgumentError.new("training_data must be provided") if training_data.nil?
174
173
 
175
174
  headers = {
176
175
  }
177
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "create_classifier")
176
+ sdk_headers = Common.new.get_sdk_headers("natural_language_classifier", "V1", "create_classifier")
177
+ headers.merge!(sdk_headers)
178
178
 
179
179
  form_data = {}
180
180
 
181
181
  unless metadata.instance_of?(StringIO) || metadata.instance_of?(File)
182
182
  metadata = metadata.respond_to?(:to_json) ? StringIO.new(metadata.to_json) : StringIO.new(metadata)
183
183
  end
184
- metadata_filename = metadata.path if metadata_filename.nil? && metadata.respond_to?(:path)
185
- form_data[:training_metadata] = HTTP::FormData::File.new(metadata, content_type: "application/json", filename: metadata_filename)
184
+ form_data[:training_metadata] = HTTP::FormData::File.new(metadata, content_type: "application/json", filename: metadata.respond_to?(:path) ? metadata.path : nil)
186
185
 
187
186
  unless training_data.instance_of?(StringIO) || training_data.instance_of?(File)
188
187
  training_data = training_data.respond_to?(:to_json) ? StringIO.new(training_data.to_json) : StringIO.new(training_data)
189
188
  end
190
- training_data_filename = training_data.path if training_data_filename.nil? && training_data.respond_to?(:path)
191
- form_data[:training_data] = HTTP::FormData::File.new(training_data, content_type: "text/csv", filename: training_data_filename)
189
+ form_data[:training_data] = HTTP::FormData::File.new(training_data, content_type: "text/csv", filename: training_data.respond_to?(:path) ? training_data.path : nil)
192
190
 
193
191
  method_url = "/v1/classifiers"
194
192
 
@@ -203,24 +201,27 @@ module IBMWatson
203
201
  end
204
202
 
205
203
  ##
206
- # @!method list_classifiers
207
- # List classifiers.
208
- # Returns an empty array if no classifiers are available.
209
- # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
210
- def list_classifiers
204
+ # @!method delete_classifier(classifier_id:)
205
+ # Delete classifier.
206
+ # @param classifier_id [String] Classifier ID to delete.
207
+ # @return [nil]
208
+ def delete_classifier(classifier_id:)
209
+ raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
210
+
211
211
  headers = {
212
212
  }
213
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "list_classifiers")
213
+ sdk_headers = Common.new.get_sdk_headers("natural_language_classifier", "V1", "delete_classifier")
214
+ headers.merge!(sdk_headers)
214
215
 
215
- method_url = "/v1/classifiers"
216
+ method_url = "/v1/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
216
217
 
217
- response = request(
218
- method: "GET",
218
+ request(
219
+ method: "DELETE",
219
220
  url: method_url,
220
221
  headers: headers,
221
222
  accept_json: true
222
223
  )
223
- response
224
+ nil
224
225
  end
225
226
 
226
227
  ##
@@ -234,7 +235,8 @@ module IBMWatson
234
235
 
235
236
  headers = {
236
237
  }
237
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "get_classifier")
238
+ sdk_headers = Common.new.get_sdk_headers("natural_language_classifier", "V1", "get_classifier")
239
+ headers.merge!(sdk_headers)
238
240
 
239
241
  method_url = "/v1/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
240
242
 
@@ -248,26 +250,25 @@ module IBMWatson
248
250
  end
249
251
 
250
252
  ##
251
- # @!method delete_classifier(classifier_id:)
252
- # Delete classifier.
253
- # @param classifier_id [String] Classifier ID to delete.
254
- # @return [nil]
255
- def delete_classifier(classifier_id:)
256
- raise ArgumentError.new("classifier_id must be provided") if classifier_id.nil?
257
-
253
+ # @!method list_classifiers
254
+ # List classifiers.
255
+ # Returns an empty array if no classifiers are available.
256
+ # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
257
+ def list_classifiers
258
258
  headers = {
259
259
  }
260
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural_language_classifier", service_version: "V1", operation_id: "delete_classifier")
260
+ sdk_headers = Common.new.get_sdk_headers("natural_language_classifier", "V1", "list_classifiers")
261
+ headers.merge!(sdk_headers)
261
262
 
262
- method_url = "/v1/classifiers/%s" % [ERB::Util.url_encode(classifier_id)]
263
+ method_url = "/v1/classifiers"
263
264
 
264
- request(
265
- method: "DELETE",
265
+ response = request(
266
+ method: "GET",
266
267
  url: method_url,
267
268
  headers: headers,
268
269
  accept_json: true
269
270
  )
270
- nil
271
+ response
271
272
  end
272
273
  end
273
274
  end
@@ -21,13 +21,12 @@
21
21
  #
22
22
  # You can create [custom
23
23
  # models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html)
24
- # with Watson Knowledge Studio to detect custom entities and relations in Natural Language
25
- # Understanding.
24
+ # with Watson Knowledge Studio to detect custom entities, relations, and categories in
25
+ # Natural Language Understanding.
26
26
 
27
27
  require "concurrent"
28
28
  require "erb"
29
29
  require "json"
30
-
31
30
  require "ibm_cloud_sdk_core"
32
31
  require_relative "./common.rb"
33
32
 
@@ -107,8 +106,9 @@ module IBMWatson
107
106
  # - Metadata
108
107
  # - Relations
109
108
  # - Semantic roles
110
- # - Sentiment.
111
- # @param features [Features] Analysis features and options.
109
+ # - Sentiment
110
+ # - Syntax (Experimental).
111
+ # @param features [Features] Specific features to analyze the document for.
112
112
  # @param text [String] The plain text to analyze. One of the `text`, `html`, or `url` parameters is
113
113
  # required.
114
114
  # @param html [String] The HTML file to analyze. One of the `text`, `html`, or `url` parameters is
@@ -138,7 +138,8 @@ module IBMWatson
138
138
 
139
139
  headers = {
140
140
  }
141
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "analyze")
141
+ sdk_headers = Common.new.get_sdk_headers("natural-language-understanding", "V1", "analyze")
142
+ headers.merge!(sdk_headers)
142
143
 
143
144
  params = {
144
145
  "version" => @version
@@ -174,25 +175,27 @@ module IBMWatson
174
175
  #########################
175
176
 
176
177
  ##
177
- # @!method list_models
178
- # List models.
179
- # Lists Watson Knowledge Studio [custom
180
- # models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html)
181
- # that are deployed to your Natural Language Understanding service.
178
+ # @!method delete_model(model_id:)
179
+ # Delete model.
180
+ # Deletes a custom model.
181
+ # @param model_id [String] Model ID of the model to delete.
182
182
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
183
- def list_models
183
+ def delete_model(model_id:)
184
+ raise ArgumentError.new("model_id must be provided") if model_id.nil?
185
+
184
186
  headers = {
185
187
  }
186
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "list_models")
188
+ sdk_headers = Common.new.get_sdk_headers("natural-language-understanding", "V1", "delete_model")
189
+ headers.merge!(sdk_headers)
187
190
 
188
191
  params = {
189
192
  "version" => @version
190
193
  }
191
194
 
192
- method_url = "/v1/models"
195
+ method_url = "/v1/models/%s" % [ERB::Util.url_encode(model_id)]
193
196
 
194
197
  response = request(
195
- method: "GET",
198
+ method: "DELETE",
196
199
  url: method_url,
197
200
  headers: headers,
198
201
  params: params,
@@ -202,26 +205,26 @@ module IBMWatson
202
205
  end
203
206
 
204
207
  ##
205
- # @!method delete_model(model_id:)
206
- # Delete model.
207
- # Deletes a custom model.
208
- # @param model_id [String] Model ID of the model to delete.
208
+ # @!method list_models
209
+ # List models.
210
+ # Lists Watson Knowledge Studio [custom
211
+ # models](https://cloud.ibm.com/docs/services/natural-language-understanding/customizing.html)
212
+ # that are deployed to your Natural Language Understanding service.
209
213
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
210
- def delete_model(model_id:)
211
- raise ArgumentError.new("model_id must be provided") if model_id.nil?
212
-
214
+ def list_models
213
215
  headers = {
214
216
  }
215
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "natural-language-understanding", service_version: "V1", operation_id: "delete_model")
217
+ sdk_headers = Common.new.get_sdk_headers("natural-language-understanding", "V1", "list_models")
218
+ headers.merge!(sdk_headers)
216
219
 
217
220
  params = {
218
221
  "version" => @version
219
222
  }
220
223
 
221
- method_url = "/v1/models/%s" % [ERB::Util.url_encode(model_id)]
224
+ method_url = "/v1/models"
222
225
 
223
226
  response = request(
224
- method: "DELETE",
227
+ method: "GET",
225
228
  url: method_url,
226
229
  headers: headers,
227
230
  params: params,
@@ -38,7 +38,6 @@
38
38
  require "concurrent"
39
39
  require "erb"
40
40
  require "json"
41
-
42
41
  require "ibm_cloud_sdk_core"
43
42
  require_relative "./common.rb"
44
43
 
@@ -107,7 +106,7 @@ module IBMWatson
107
106
  #########################
108
107
 
109
108
  ##
110
- # @!method profile(content:, accept:, content_type: nil, content_language: nil, accept_language: nil, raw_scores: nil, csv_headers: nil, consumption_preferences: nil)
109
+ # @!method profile(content:, accept:, content_language: nil, accept_language: nil, raw_scores: nil, csv_headers: nil, consumption_preferences: nil, content_type: nil)
111
110
  # Get profile.
112
111
  # Generates a personality profile for the author of the input text. The service
113
112
  # accepts a maximum of 20 MB of input content, but it requires much less text to
@@ -158,10 +157,6 @@ module IBMWatson
158
157
  # For JSON input, provide an object of type `Content`.
159
158
  # @param accept [String] The type of the response. For more information, see **Accept types** in the method
160
159
  # description.
161
- # @param content_type [String] The type of the input. For more information, see **Content types** in the method
162
- # description.
163
- #
164
- # Default: `text/plain`.
165
160
  # @param content_language [String] The language of the input text for the request: Arabic, English, Japanese, Korean,
166
161
  # or Spanish. Regional variants are treated as their parent language; for example,
167
162
  # `en-US` is interpreted as `en`.
@@ -186,19 +181,24 @@ module IBMWatson
186
181
  # (`text/csv`).
187
182
  # @param consumption_preferences [Boolean] Indicates whether consumption preferences are returned with the results. By
188
183
  # default, no consumption preferences are returned.
184
+ # @param content_type [String] The type of the input. For more information, see **Content types** in the method
185
+ # description.
186
+ #
187
+ # Default: `text/plain`.
189
188
  # @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
190
- def profile(content:, accept:, content_type: nil, content_language: nil, accept_language: nil, raw_scores: nil, csv_headers: nil, consumption_preferences: nil)
189
+ def profile(content:, accept:, content_language: nil, accept_language: nil, raw_scores: nil, csv_headers: nil, consumption_preferences: nil, content_type: nil)
191
190
  raise ArgumentError.new("content must be provided") if content.nil?
192
191
 
193
192
  raise ArgumentError.new("accept must be provided") if accept.nil?
194
193
 
195
194
  headers = {
196
195
  "Accept" => accept,
197
- "Content-Type" => content_type,
198
196
  "Content-Language" => content_language,
199
- "Accept-Language" => accept_language
197
+ "Accept-Language" => accept_language,
198
+ "Content-Type" => content_type
200
199
  }
201
- headers = Common.new.get_sdk_headers(headers: headers, service_name: "personality_insights", service_version: "V3", operation_id: "profile")
200
+ sdk_headers = Common.new.get_sdk_headers("personality_insights", "V3", "profile")
201
+ headers.merge!(sdk_headers)
202
202
 
203
203
  params = {
204
204
  "version" => @version,