ibm_watson 1.0.0.rc3 → 1.0.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 +8 -8
- data/lib/ibm_watson.rb +2 -9
- data/lib/ibm_watson/assistant_v1.rb +5 -2
- data/lib/ibm_watson/assistant_v2.rb +3 -0
- data/lib/ibm_watson/authenticators.rb +15 -0
- data/lib/ibm_watson/discovery_v1.rb +79 -15
- data/lib/ibm_watson/speech_to_text_v1.rb +3 -2
- data/lib/ibm_watson/text_to_speech_v1.rb +29 -50
- data/lib/ibm_watson/tone_analyzer_v3.rb +2 -1
- data/lib/ibm_watson/version.rb +1 -1
- data/lib/ibm_watson/visual_recognition_v4.rb +658 -0
- data/test/integration/test_discovery_v1.rb +1 -1
- data/test/integration/test_speech_to_text_v1.rb +1 -1
- data/test/integration/test_tone_analyzer_v3.rb +4 -4
- data/test/integration/test_visual_recognition_v4.rb +78 -0
- data/test/unit/test_discovery_v1.rb +25 -0
- data/test/unit/test_visual_recognition_v4.rb +412 -0
- metadata +13 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39e10926734524673eccb99a00cdcb9356d3570514b6ee6e320054b6a11f310e
|
4
|
+
data.tar.gz: 50a19a96c0bfb3843eba4540bc36a417ed0aed27ca1eb02e491c73a2897c2912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 313e51742037b568acc09e6caff75508e6a3f900cea657a499fc4f7f0b15052c224071577ccd4beb6774a3fc0c60eda8f22fe2393c2eaf84f594d6a5cc38b32b
|
7
|
+
data.tar.gz: d35a075c19323141bac2c5c15bf61b873d616ac5c4bb9578969713294056b81207d3d200560fba3947ca019acc00a6bb30bdebc8638e95c8ffca50df810e03ed
|
data/README.md
CHANGED
@@ -92,8 +92,8 @@ With a credential file, you just need to put the file in the right place and the
|
|
92
92
|
|
93
93
|
The file downloaded will be called `ibm-credentials.env`. This is the name the SDK will search for and **must** be preserved unless you want to configure the file path (more on that later). The SDK will look for your `ibm-credentials.env` file in the following places (in order):
|
94
94
|
|
95
|
-
* Your system's home directory
|
96
95
|
* The top-level directory of the project you're using the SDK in
|
96
|
+
* Your system's home directory
|
97
97
|
|
98
98
|
As long as you set that up correctly, you don't have to worry about setting any authentication options in your code. So, for example, if you created and downloaded the credential file for your Discovery instance, you just need to do the following:
|
99
99
|
|
@@ -130,7 +130,7 @@ You supply either an IAM service **API key** or an **access token**:
|
|
130
130
|
|
131
131
|
```ruby
|
132
132
|
# In the constructor, letting the SDK manage the IAM token
|
133
|
-
authenticator =
|
133
|
+
authenticator = IBMWatson::Authenticators::IamAuthenticator.new(
|
134
134
|
apikey: "<iam_apikey>",
|
135
135
|
url: "<iam_url>" # optional - the default value is https://iam.cloud.ibm.com/identity/token
|
136
136
|
)
|
@@ -144,7 +144,7 @@ discover.service_url = "<service-url>" # setting service url
|
|
144
144
|
#### Supplying the access token
|
145
145
|
|
146
146
|
```ruby
|
147
|
-
authenticator =
|
147
|
+
authenticator = IBMWatson::Authenticators::BearerTokenAuthenticator.new(
|
148
148
|
bearer_token: "<access_token>"
|
149
149
|
)
|
150
150
|
discovery = IBMWatson::DiscoveryV1.new(version: "2017-10-16", authenticator)
|
@@ -157,7 +157,7 @@ require "ibm_watson"
|
|
157
157
|
require "ibm_cloud_sdk_core"
|
158
158
|
include IBMWatson
|
159
159
|
# In the constructor
|
160
|
-
authenticator =
|
160
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
161
161
|
username: "<username>",
|
162
162
|
password: "<password>"
|
163
163
|
)
|
@@ -177,7 +177,7 @@ Requests can be sent asynchronously. There are two asynchronous methods availabl
|
|
177
177
|
When `await` is used, the request is made synchronously.
|
178
178
|
|
179
179
|
```ruby
|
180
|
-
authenticator =
|
180
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
181
181
|
username: "<username>",
|
182
182
|
password: "<password>"
|
183
183
|
)
|
@@ -196,7 +196,7 @@ output = future.value # The response is accessible at future.value
|
|
196
196
|
When `async` is used, the request is made asynchronously
|
197
197
|
|
198
198
|
```ruby
|
199
|
-
authenticator =
|
199
|
+
authenticator = IBMWatson::Authenticators::BasicAuthenticator.new(
|
200
200
|
username: "<username>",
|
201
201
|
password: "<password>"
|
202
202
|
)
|
@@ -350,7 +350,7 @@ The SDK will manage the token for the user
|
|
350
350
|
|
351
351
|
```ruby
|
352
352
|
|
353
|
-
authenticator =
|
353
|
+
authenticator = IBMWatson::Authenticators::CLoudPakForDataAuthenticator.new(
|
354
354
|
username: "<username>",
|
355
355
|
password: "<password>",
|
356
356
|
url: "<authentication url>",
|
@@ -394,4 +394,4 @@ We'd love to highlight cool open-source projects that use this SDK! If you'd lik
|
|
394
394
|
[license]: http://www.apache.org/licenses/LICENSE-2.0
|
395
395
|
[vcap_services]: https://cloud.ibm.com/docs/services/watson?topic=watson-vcapServices
|
396
396
|
[ibm-cloud-onboarding]: http://cloud.ibm.com/registration?target=/developer/watson&cm_sp=WatsonPlatform-WatsonServices-_-OnPageNavLink-IBMWatson_SDKs-_-Ruby
|
397
|
-
[ivar]: http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/IVar.html
|
397
|
+
[ivar]: http://ruby-concurrency.github.io/concurrent-ruby/Concurrent/IVar.html
|
data/lib/ibm_watson.rb
CHANGED
@@ -7,15 +7,6 @@ module IBMWatson
|
|
7
7
|
ApiException = IBMCloudSdkCore::ApiException
|
8
8
|
DetailedResponse = IBMCloudSdkCore::DetailedResponse
|
9
9
|
|
10
|
-
module Authenticators
|
11
|
-
BasicAuthenticator = IBMCloudSdkCore::BasicAuthenticator
|
12
|
-
BearerTokenAuthenticator = IBMCloudSdkCore::BearerTokenAuthenticator
|
13
|
-
CloudPakForDataAuthenticator = IBMCloudSdkCore::CloudPakForDataAuthenticator
|
14
|
-
ConfigBasedAuthenticatorFactory = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory
|
15
|
-
IamAuthenticator = IBMCloudSdkCore::IamAuthenticator
|
16
|
-
NoAuthAuthenticator = IBMCloudSdkCore::NoAuthAuthenticator
|
17
|
-
end
|
18
|
-
|
19
10
|
require_relative("./ibm_watson/personality_insights_v3.rb")
|
20
11
|
require_relative("./ibm_watson/tone_analyzer_v3.rb")
|
21
12
|
require_relative("./ibm_watson/assistant_v1.rb")
|
@@ -25,9 +16,11 @@ module IBMWatson
|
|
25
16
|
require_relative("./ibm_watson/natural_language_understanding_v1.rb")
|
26
17
|
require_relative("./ibm_watson/speech_to_text_v1.rb")
|
27
18
|
require_relative("./ibm_watson/visual_recognition_v3.rb")
|
19
|
+
require_relative("./ibm_watson/visual_recognition_v4.rb")
|
28
20
|
require_relative("./ibm_watson/natural_language_classifier_v1.rb")
|
29
21
|
require_relative("./ibm_watson/language_translator_v3.rb")
|
30
22
|
require_relative("./ibm_watson/compare_comply_v1.rb")
|
31
23
|
require_relative("./ibm_watson/websocket/recognize_callback.rb")
|
24
|
+
require_relative("./ibm_watson/authenticators.rb")
|
32
25
|
require_relative("./ibm_watson/common.rb")
|
33
26
|
end
|
@@ -17,6 +17,9 @@
|
|
17
17
|
# The IBM Watson™ Assistant service combines machine learning, natural language
|
18
18
|
# understanding, and an integrated dialog editor to create conversation flows between your
|
19
19
|
# apps and your users.
|
20
|
+
#
|
21
|
+
# The Assistant v1 API provides authoring methods your application can use to create or
|
22
|
+
# update a workspace.
|
20
23
|
|
21
24
|
require "concurrent"
|
22
25
|
require "erb"
|
@@ -72,8 +75,8 @@ module IBMWatson
|
|
72
75
|
# Get response to user input.
|
73
76
|
# Send user input to a workspace and receive a response.
|
74
77
|
#
|
75
|
-
# **
|
76
|
-
#
|
78
|
+
# **Important:** This method has been superseded by the new v2 runtime API. The v2
|
79
|
+
# API offers significant advantages, including ease of deployment, automatic state
|
77
80
|
# management, versioning, and search capabilities. For more information, see the
|
78
81
|
# [documentation](https://cloud.ibm.com/docs/services/assistant?topic=assistant-api-overview).
|
79
82
|
#
|
@@ -17,6 +17,9 @@
|
|
17
17
|
# The IBM Watson™ Assistant service combines machine learning, natural language
|
18
18
|
# understanding, and an integrated dialog editor to create conversation flows between your
|
19
19
|
# apps and your users.
|
20
|
+
#
|
21
|
+
# The Assistant v2 API provides runtime methods your client application can use to send
|
22
|
+
# user input to an assistant and receive a response.
|
20
23
|
|
21
24
|
require "concurrent"
|
22
25
|
require "erb"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require("ibm_cloud_sdk_core")
|
4
|
+
|
5
|
+
# Module for the Watson APIs
|
6
|
+
module IBMWatson
|
7
|
+
class Authenticators
|
8
|
+
BasicAuthenticator = IBMCloudSdkCore::BasicAuthenticator
|
9
|
+
BearerTokenAuthenticator = IBMCloudSdkCore::BearerTokenAuthenticator
|
10
|
+
CloudPakForDataAuthenticator = IBMCloudSdkCore::CloudPakForDataAuthenticator
|
11
|
+
ConfigBasedAuthenticatorFactory = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory
|
12
|
+
IamAuthenticator = IBMCloudSdkCore::IamAuthenticator
|
13
|
+
NoAuthAuthenticator = IBMCloudSdkCore::NoAuthAuthenticator
|
14
|
+
end
|
15
|
+
end
|
@@ -260,10 +260,11 @@ module IBMWatson
|
|
260
260
|
}
|
261
261
|
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_fields")
|
262
262
|
headers.merge!(sdk_headers)
|
263
|
+
collection_ids *= "," unless collection_ids.nil?
|
263
264
|
|
264
265
|
params = {
|
265
266
|
"version" => @version,
|
266
|
-
"collection_ids" => collection_ids
|
267
|
+
"collection_ids" => collection_ids
|
267
268
|
}
|
268
269
|
|
269
270
|
method_url = "/v1/environments/%s/fields" % [ERB::Util.url_encode(environment_id)]
|
@@ -1305,7 +1306,7 @@ module IBMWatson
|
|
1305
1306
|
#########################
|
1306
1307
|
|
1307
1308
|
##
|
1308
|
-
# @!method query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
|
1309
|
+
# @!method query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, spelling_suggestions: nil, x_watson_logging_opt_out: nil)
|
1309
1310
|
# Query a collection.
|
1310
1311
|
# By using this method, you can construct long queries. For details, see the
|
1311
1312
|
# [Discovery
|
@@ -1364,9 +1365,15 @@ module IBMWatson
|
|
1364
1365
|
# a **number** type field is specified, returned results are biased towards higher
|
1365
1366
|
# field values. This parameter cannot be used in the same query as the **sort**
|
1366
1367
|
# parameter.
|
1368
|
+
# @param spelling_suggestions [Boolean] When `true` and the **natural_language_query** parameter is used, the
|
1369
|
+
# **natural_languge_query** parameter is spell checked. The most likely correction
|
1370
|
+
# is retunred in the **suggested_query** field of the response (if one exists).
|
1371
|
+
#
|
1372
|
+
# **Important:** this parameter is only valid when using the Cloud Pak version of
|
1373
|
+
# Discovery.
|
1367
1374
|
# @param x_watson_logging_opt_out [Boolean] If `true`, queries are not stored in the Discovery **Logs** endpoint.
|
1368
1375
|
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1369
|
-
def query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil)
|
1376
|
+
def query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, spelling_suggestions: nil, x_watson_logging_opt_out: nil)
|
1370
1377
|
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1371
1378
|
|
1372
1379
|
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
@@ -1400,7 +1407,8 @@ module IBMWatson
|
|
1400
1407
|
"similar" => similar,
|
1401
1408
|
"similar.document_ids" => similar_document_ids,
|
1402
1409
|
"similar.fields" => similar_fields,
|
1403
|
-
"bias" => bias
|
1410
|
+
"bias" => bias,
|
1411
|
+
"spelling_suggestions" => spelling_suggestions
|
1404
1412
|
}
|
1405
1413
|
|
1406
1414
|
method_url = "/v1/environments/%s/collections/%s/query" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
@@ -1478,6 +1486,11 @@ module IBMWatson
|
|
1478
1486
|
}
|
1479
1487
|
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_notices")
|
1480
1488
|
headers.merge!(sdk_headers)
|
1489
|
+
_return *= "," unless _return.nil?
|
1490
|
+
sort *= "," unless sort.nil?
|
1491
|
+
passages_fields *= "," unless passages_fields.nil?
|
1492
|
+
similar_document_ids *= "," unless similar_document_ids.nil?
|
1493
|
+
similar_fields *= "," unless similar_fields.nil?
|
1481
1494
|
|
1482
1495
|
params = {
|
1483
1496
|
"version" => @version,
|
@@ -1487,17 +1500,17 @@ module IBMWatson
|
|
1487
1500
|
"passages" => passages,
|
1488
1501
|
"aggregation" => aggregation,
|
1489
1502
|
"count" => count,
|
1490
|
-
"return" => _return
|
1503
|
+
"return" => _return,
|
1491
1504
|
"offset" => offset,
|
1492
|
-
"sort" => sort
|
1505
|
+
"sort" => sort,
|
1493
1506
|
"highlight" => highlight,
|
1494
|
-
"passages.fields" => passages_fields
|
1507
|
+
"passages.fields" => passages_fields,
|
1495
1508
|
"passages.count" => passages_count,
|
1496
1509
|
"passages.characters" => passages_characters,
|
1497
1510
|
"deduplicate.field" => deduplicate_field,
|
1498
1511
|
"similar" => similar,
|
1499
|
-
"similar.document_ids" => similar_document_ids
|
1500
|
-
"similar.fields" => similar_fields
|
1512
|
+
"similar.document_ids" => similar_document_ids,
|
1513
|
+
"similar.fields" => similar_fields
|
1501
1514
|
}
|
1502
1515
|
|
1503
1516
|
method_url = "/v1/environments/%s/collections/%s/notices" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
@@ -1679,23 +1692,28 @@ module IBMWatson
|
|
1679
1692
|
}
|
1680
1693
|
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "federated_query_notices")
|
1681
1694
|
headers.merge!(sdk_headers)
|
1695
|
+
collection_ids *= "," unless collection_ids.nil?
|
1696
|
+
_return *= "," unless _return.nil?
|
1697
|
+
sort *= "," unless sort.nil?
|
1698
|
+
similar_document_ids *= "," unless similar_document_ids.nil?
|
1699
|
+
similar_fields *= "," unless similar_fields.nil?
|
1682
1700
|
|
1683
1701
|
params = {
|
1684
1702
|
"version" => @version,
|
1685
|
-
"collection_ids" => collection_ids
|
1703
|
+
"collection_ids" => collection_ids,
|
1686
1704
|
"filter" => filter,
|
1687
1705
|
"query" => query,
|
1688
1706
|
"natural_language_query" => natural_language_query,
|
1689
1707
|
"aggregation" => aggregation,
|
1690
1708
|
"count" => count,
|
1691
|
-
"return" => _return
|
1709
|
+
"return" => _return,
|
1692
1710
|
"offset" => offset,
|
1693
|
-
"sort" => sort
|
1711
|
+
"sort" => sort,
|
1694
1712
|
"highlight" => highlight,
|
1695
1713
|
"deduplicate.field" => deduplicate_field,
|
1696
1714
|
"similar" => similar,
|
1697
|
-
"similar.document_ids" => similar_document_ids
|
1698
|
-
"similar.fields" => similar_fields
|
1715
|
+
"similar.document_ids" => similar_document_ids,
|
1716
|
+
"similar.fields" => similar_fields
|
1699
1717
|
}
|
1700
1718
|
|
1701
1719
|
method_url = "/v1/environments/%s/notices" % [ERB::Util.url_encode(environment_id)]
|
@@ -1709,6 +1727,51 @@ module IBMWatson
|
|
1709
1727
|
)
|
1710
1728
|
response
|
1711
1729
|
end
|
1730
|
+
|
1731
|
+
##
|
1732
|
+
# @!method get_autocompletion(environment_id:, collection_id:, prefix:, field: nil, count: nil)
|
1733
|
+
# Get Autocomplete Suggestions.
|
1734
|
+
# Returns completion query suggestions for the specified prefix. /n/n
|
1735
|
+
# **Important:** this method is only valid when using the Cloud Pak version of
|
1736
|
+
# Discovery.
|
1737
|
+
# @param environment_id [String] The ID of the environment.
|
1738
|
+
# @param collection_id [String] The ID of the collection.
|
1739
|
+
# @param prefix [String] The prefix to use for autocompletion. For example, the prefix `Ho` could
|
1740
|
+
# autocomplete to `Hot`, `Housing`, or `How do I upgrade`. Possible completions are.
|
1741
|
+
# @param field [String] The field in the result documents that autocompletion suggestions are identified
|
1742
|
+
# from.
|
1743
|
+
# @param count [Fixnum] The number of autocompletion suggestions to return.
|
1744
|
+
# @return [IBMCloudSdkCore::DetailedResponse] A `IBMCloudSdkCore::DetailedResponse` object representing the response.
|
1745
|
+
def get_autocompletion(environment_id:, collection_id:, prefix:, field: nil, count: nil)
|
1746
|
+
raise ArgumentError.new("environment_id must be provided") if environment_id.nil?
|
1747
|
+
|
1748
|
+
raise ArgumentError.new("collection_id must be provided") if collection_id.nil?
|
1749
|
+
|
1750
|
+
raise ArgumentError.new("prefix must be provided") if prefix.nil?
|
1751
|
+
|
1752
|
+
headers = {
|
1753
|
+
}
|
1754
|
+
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_autocompletion")
|
1755
|
+
headers.merge!(sdk_headers)
|
1756
|
+
|
1757
|
+
params = {
|
1758
|
+
"version" => @version,
|
1759
|
+
"prefix" => prefix,
|
1760
|
+
"field" => field,
|
1761
|
+
"count" => count
|
1762
|
+
}
|
1763
|
+
|
1764
|
+
method_url = "/v1/environments/%s/collections/%s/autocompletion" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)]
|
1765
|
+
|
1766
|
+
response = request(
|
1767
|
+
method: "GET",
|
1768
|
+
url: method_url,
|
1769
|
+
headers: headers,
|
1770
|
+
params: params,
|
1771
|
+
accept_json: true
|
1772
|
+
)
|
1773
|
+
response
|
1774
|
+
end
|
1712
1775
|
#########################
|
1713
1776
|
# Training data
|
1714
1777
|
#########################
|
@@ -2215,6 +2278,7 @@ module IBMWatson
|
|
2215
2278
|
}
|
2216
2279
|
sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_log")
|
2217
2280
|
headers.merge!(sdk_headers)
|
2281
|
+
sort *= "," unless sort.nil?
|
2218
2282
|
|
2219
2283
|
params = {
|
2220
2284
|
"version" => @version,
|
@@ -2222,7 +2286,7 @@ module IBMWatson
|
|
2222
2286
|
"query" => query,
|
2223
2287
|
"count" => count,
|
2224
2288
|
"offset" => offset,
|
2225
|
-
"sort" => sort
|
2289
|
+
"sort" => sort
|
2226
2290
|
}
|
2227
2291
|
|
2228
2292
|
method_url = "/v1/logs"
|
@@ -365,9 +365,9 @@ module IBMWatson
|
|
365
365
|
headers = {
|
366
366
|
"Content-Type" => content_type
|
367
367
|
}
|
368
|
-
keywords *= "," unless keywords.nil?
|
369
368
|
sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "recognize")
|
370
369
|
headers.merge!(sdk_headers)
|
370
|
+
keywords *= "," unless keywords.nil?
|
371
371
|
|
372
372
|
params = {
|
373
373
|
"model" => model,
|
@@ -942,6 +942,7 @@ module IBMWatson
|
|
942
942
|
}
|
943
943
|
sdk_headers = Common.new.get_sdk_headers("speech_to_text", "V1", "create_job")
|
944
944
|
headers.merge!(sdk_headers)
|
945
|
+
keywords *= "," unless keywords.nil?
|
945
946
|
|
946
947
|
params = {
|
947
948
|
"model" => model,
|
@@ -954,7 +955,7 @@ module IBMWatson
|
|
954
955
|
"base_model_version" => base_model_version,
|
955
956
|
"customization_weight" => customization_weight,
|
956
957
|
"inactivity_timeout" => inactivity_timeout,
|
957
|
-
"keywords" => keywords
|
958
|
+
"keywords" => keywords,
|
958
959
|
"keywords_threshold" => keywords_threshold,
|
959
960
|
"max_alternatives" => max_alternatives,
|
960
961
|
"word_alternatives_threshold" => word_alternatives_threshold,
|
@@ -158,7 +158,8 @@ module IBMWatson
|
|
158
158
|
# The service can return audio in the following formats (MIME types).
|
159
159
|
# * Where indicated, you can optionally specify the sampling rate (`rate`) of the
|
160
160
|
# audio. You must specify a sampling rate for the `audio/l16` and `audio/mulaw`
|
161
|
-
# formats. A specified sampling rate must lie in the range of 8 kHz to 192 kHz.
|
161
|
+
# formats. A specified sampling rate must lie in the range of 8 kHz to 192 kHz. Some
|
162
|
+
# formats restrict the sampling rate to certain values, as noted.
|
162
163
|
# * For the `audio/l16` format, you can optionally specify the endianness
|
163
164
|
# (`endianness`) of the audio: `endianness=big-endian` or
|
164
165
|
# `endianness=little-endian`.
|
@@ -167,55 +168,33 @@ module IBMWatson
|
|
167
168
|
# of the response audio. If you omit an audio format altogether, the service returns
|
168
169
|
# the audio in Ogg format with the Opus codec (`audio/ogg;codecs=opus`). The service
|
169
170
|
# always returns single-channel audio.
|
170
|
-
# * `audio/basic`
|
171
|
-
#
|
172
|
-
#
|
173
|
-
# * `audio/
|
174
|
-
#
|
175
|
-
#
|
176
|
-
# 22,050 Hz.
|
177
|
-
# * `audio/
|
178
|
-
#
|
179
|
-
#
|
180
|
-
# `
|
181
|
-
#
|
182
|
-
#
|
183
|
-
#
|
184
|
-
#
|
185
|
-
#
|
186
|
-
#
|
187
|
-
#
|
188
|
-
# 22,050 Hz.
|
189
|
-
# * `audio/
|
190
|
-
#
|
191
|
-
#
|
192
|
-
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
-
#
|
197
|
-
#
|
198
|
-
# You can optionally specify the `rate` of the audio. The default sampling rate is
|
199
|
-
# 22,050 Hz.
|
200
|
-
# * `audio/ogg;codecs=vorbis`
|
201
|
-
#
|
202
|
-
# You can optionally specify the `rate` of the audio. The default sampling rate is
|
203
|
-
# 22,050 Hz.
|
204
|
-
# * `audio/wav`
|
205
|
-
#
|
206
|
-
# You can optionally specify the `rate` of the audio. The default sampling rate is
|
207
|
-
# 22,050 Hz.
|
208
|
-
# * `audio/webm`
|
209
|
-
#
|
210
|
-
# The service returns the audio in the `opus` codec. The service returns audio
|
211
|
-
# with a sampling rate of 48,000 Hz.
|
212
|
-
# * `audio/webm;codecs=opus`
|
213
|
-
#
|
214
|
-
# The service returns audio with a sampling rate of 48,000 Hz.
|
215
|
-
# * `audio/webm;codecs=vorbis`
|
216
|
-
#
|
217
|
-
# You can optionally specify the `rate` of the audio. The default sampling rate is
|
218
|
-
# 22,050 Hz.
|
171
|
+
# * `audio/basic` - The service returns audio with a sampling rate of 8000 Hz.
|
172
|
+
# * `audio/flac` - You can optionally specify the `rate` of the audio. The default
|
173
|
+
# sampling rate is 22,050 Hz.
|
174
|
+
# * `audio/l16` - You must specify the `rate` of the audio. You can optionally
|
175
|
+
# specify the `endianness` of the audio. The default endianness is `little-endian`.
|
176
|
+
# * `audio/mp3` - You can optionally specify the `rate` of the audio. The default
|
177
|
+
# sampling rate is 22,050 Hz.
|
178
|
+
# * `audio/mpeg` - You can optionally specify the `rate` of the audio. The default
|
179
|
+
# sampling rate is 22,050 Hz.
|
180
|
+
# * `audio/mulaw` - You must specify the `rate` of the audio.
|
181
|
+
# * `audio/ogg` - The service returns the audio in the `vorbis` codec. You can
|
182
|
+
# optionally specify the `rate` of the audio. The default sampling rate is 22,050
|
183
|
+
# Hz.
|
184
|
+
# * `audio/ogg;codecs=opus` - You can optionally specify the `rate` of the audio.
|
185
|
+
# Only the following values are valid sampling rates: `48000`, `24000`, `16000`,
|
186
|
+
# `12000`, or `8000`. If you specify a value other than one of these, the service
|
187
|
+
# returns an error. The default sampling rate is 48,000 Hz.
|
188
|
+
# * `audio/ogg;codecs=vorbis` - You can optionally specify the `rate` of the audio.
|
189
|
+
# The default sampling rate is 22,050 Hz.
|
190
|
+
# * `audio/wav` - You can optionally specify the `rate` of the audio. The default
|
191
|
+
# sampling rate is 22,050 Hz.
|
192
|
+
# * `audio/webm` - The service returns the audio in the `opus` codec. The service
|
193
|
+
# returns audio with a sampling rate of 48,000 Hz.
|
194
|
+
# * `audio/webm;codecs=opus` - The service returns audio with a sampling rate of
|
195
|
+
# 48,000 Hz.
|
196
|
+
# * `audio/webm;codecs=vorbis` - You can optionally specify the `rate` of the audio.
|
197
|
+
# The default sampling rate is 22,050 Hz.
|
219
198
|
#
|
220
199
|
# For more information about specifying an audio format, including additional
|
221
200
|
# details about some of the formats, see [Audio
|