google-cloud-speech 0.29.0 → 0.30.0
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/.yardopts +2 -1
- data/LICENSE +1 -1
- data/README.md +69 -43
- data/lib/google/cloud/speech.rb +94 -252
- data/lib/google/cloud/speech/v1.rb +11 -1
- data/lib/google/cloud/speech/v1/cloud_speech_services_pb.rb +1 -1
- data/lib/google/cloud/speech/{version.rb → v1/credentials.rb} +12 -2
- data/lib/google/cloud/speech/v1/doc/google/cloud/speech/v1/cloud_speech.rb +2 -2
- data/lib/google/cloud/speech/v1/doc/google/longrunning/operations.rb +92 -0
- data/lib/google/cloud/speech/v1/doc/google/protobuf/any.rb +1 -1
- data/lib/google/cloud/speech/v1/doc/google/protobuf/duration.rb +1 -1
- data/lib/google/cloud/speech/v1/doc/google/rpc/status.rb +1 -1
- data/lib/google/cloud/speech/v1/doc/overview.rb +1 -1
- data/lib/google/cloud/speech/v1/helpers.rb +93 -0
- data/lib/google/cloud/speech/v1/speech_client.rb +26 -49
- data/lib/google/cloud/speech/v1/speech_client_config.json +5 -5
- data/lib/google/cloud/speech/v1/stream.rb +614 -0
- data/lib/google/cloud/speech/v1p1beta1.rb +126 -0
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_pb.rb +175 -0
- data/lib/google/cloud/speech/v1p1beta1/cloud_speech_services_pb.rb +54 -0
- data/lib/google/cloud/speech/v1p1beta1/credentials.rb +32 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/google/cloud/speech/v1p1beta1/cloud_speech.rb +625 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/google/longrunning/operations.rb +92 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/google/protobuf/any.rb +124 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/google/protobuf/duration.rb +90 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/google/rpc/status.rb +83 -0
- data/lib/google/cloud/speech/v1p1beta1/doc/overview.rb +73 -0
- data/lib/google/cloud/speech/v1p1beta1/helpers.rb +93 -0
- data/lib/google/cloud/speech/v1p1beta1/speech_client.rb +322 -0
- data/lib/google/cloud/speech/v1p1beta1/speech_client_config.json +41 -0
- data/lib/google/cloud/speech/v1p1beta1/stream.rb +614 -0
- metadata +29 -120
- data/lib/google-cloud-speech.rb +0 -142
- data/lib/google/cloud/speech/audio.rb +0 -330
- data/lib/google/cloud/speech/convert.rb +0 -46
- data/lib/google/cloud/speech/credentials.rb +0 -57
- data/lib/google/cloud/speech/operation.rb +0 -262
- data/lib/google/cloud/speech/project.rb +0 -651
- data/lib/google/cloud/speech/result.rb +0 -240
- data/lib/google/cloud/speech/service.rb +0 -121
- data/lib/google/cloud/speech/stream.rb +0 -564
@@ -0,0 +1,93 @@
|
|
1
|
+
# Copyright 2018 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require "google/cloud/speech/v1p1beta1/speech_client"
|
16
|
+
require "google/cloud/speech/v1p1beta1/stream"
|
17
|
+
|
18
|
+
module Google
|
19
|
+
module Cloud
|
20
|
+
module Speech
|
21
|
+
module V1p1beta1
|
22
|
+
class SpeechClient
|
23
|
+
# Performs bidirectional streaming speech recognition: receive results
|
24
|
+
# while sending audio. This method is only available via the gRPC API
|
25
|
+
# (not REST).
|
26
|
+
#
|
27
|
+
# @param [Google::Cloud::Speech::V1p1beta1::StreamingRecognitionConfig,
|
28
|
+
# Hash] streaming_config
|
29
|
+
# Provides information to the recognizer that specifies how to
|
30
|
+
# process the request.
|
31
|
+
# A hash of the same form as
|
32
|
+
# +Google::Cloud::Speech::V1p1beta1::StreamingRecognitionConfig+
|
33
|
+
# can also be provided.
|
34
|
+
# @param [Google::Gax::CallOptions] options
|
35
|
+
# Overrides the default settings for this call, e.g, timeout,
|
36
|
+
# retries, etc.
|
37
|
+
# @return [Google::Cloud::Speech::V1p1beta1::Stream]
|
38
|
+
# An object that streams the requests and responses.
|
39
|
+
#
|
40
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
41
|
+
#
|
42
|
+
# @example
|
43
|
+
# require "google/cloud/speech"
|
44
|
+
#
|
45
|
+
# speech_client = Google::Cloud::Speech.new version: :v1p1beta1
|
46
|
+
# streaming_config = {
|
47
|
+
# config: {
|
48
|
+
# encoding: :linear16,
|
49
|
+
# language_code: "en-US",
|
50
|
+
# sample_rate_hertz: 16000
|
51
|
+
# }
|
52
|
+
# }
|
53
|
+
# stream = speech_client.streaming_recognize(streaming_config)
|
54
|
+
#
|
55
|
+
# # Stream 5 seconds of audio from the microphone
|
56
|
+
# # Actual implementation of microphone input varies by platform
|
57
|
+
# 5.times do
|
58
|
+
# stream.send MicrophoneInput.read(32000)
|
59
|
+
# end
|
60
|
+
#
|
61
|
+
# stream.stop
|
62
|
+
# stream.wait_until_complete!
|
63
|
+
#
|
64
|
+
# results = stream.results
|
65
|
+
# result = results.first.alternatives.first
|
66
|
+
# result.transcript #=> "how old is the Brooklyn Bridge"
|
67
|
+
# result.confidence #=> 0.9826789498329163
|
68
|
+
#
|
69
|
+
def streaming_recognize streaming_config, options: nil
|
70
|
+
if streaming_config.is_a?(::Hash) &&
|
71
|
+
streaming_config[:config] &&
|
72
|
+
streaming_config[:config][:encoding]
|
73
|
+
streaming_config[:config][:encoding] =
|
74
|
+
streaming_config[:config][:encoding].upcase
|
75
|
+
end
|
76
|
+
V1p1beta1::Stream.new(
|
77
|
+
streaming_config,
|
78
|
+
proc do |reqs|
|
79
|
+
request_protos = reqs.lazy.map do |req|
|
80
|
+
Google::Gax.to_proto(
|
81
|
+
req,
|
82
|
+
Google::Cloud::Speech::V1p1beta1::StreamingRecognizeRequest
|
83
|
+
)
|
84
|
+
end
|
85
|
+
@streaming_recognize.call(request_protos, options)
|
86
|
+
end
|
87
|
+
)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,322 @@
|
|
1
|
+
# Copyright 2018 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
#
|
15
|
+
# EDITING INSTRUCTIONS
|
16
|
+
# This file was generated from the file
|
17
|
+
# https://github.com/googleapis/googleapis/blob/master/google/cloud/speech/v1p1beta1/cloud_speech.proto,
|
18
|
+
# and updates to that file get reflected here through a refresh process.
|
19
|
+
# For the short term, the refresh process will only be runnable by Google
|
20
|
+
# engineers.
|
21
|
+
|
22
|
+
require "json"
|
23
|
+
require "pathname"
|
24
|
+
|
25
|
+
require "google/gax"
|
26
|
+
require "google/gax/operation"
|
27
|
+
require "google/longrunning/operations_client"
|
28
|
+
|
29
|
+
require "google/cloud/speech/v1p1beta1/cloud_speech_pb"
|
30
|
+
require "google/cloud/speech/v1p1beta1/credentials"
|
31
|
+
|
32
|
+
module Google
|
33
|
+
module Cloud
|
34
|
+
module Speech
|
35
|
+
module V1p1beta1
|
36
|
+
# Service that implements Google Cloud Speech API.
|
37
|
+
#
|
38
|
+
# @!attribute [r] speech_stub
|
39
|
+
# @return [Google::Cloud::Speech::V1p1beta1::Speech::Stub]
|
40
|
+
class SpeechClient
|
41
|
+
attr_reader :speech_stub
|
42
|
+
|
43
|
+
# The default address of the service.
|
44
|
+
SERVICE_ADDRESS = "speech.googleapis.com".freeze
|
45
|
+
|
46
|
+
# The default port of the service.
|
47
|
+
DEFAULT_SERVICE_PORT = 443
|
48
|
+
|
49
|
+
DEFAULT_TIMEOUT = 30
|
50
|
+
|
51
|
+
# The scopes needed to make gRPC calls to all of the methods defined in
|
52
|
+
# this service.
|
53
|
+
ALL_SCOPES = [
|
54
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
55
|
+
].freeze
|
56
|
+
|
57
|
+
class OperationsClient < Google::Longrunning::OperationsClient
|
58
|
+
self::SERVICE_ADDRESS = SpeechClient::SERVICE_ADDRESS
|
59
|
+
end
|
60
|
+
|
61
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
62
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
63
|
+
# be many types.
|
64
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
65
|
+
# authenticating requests made by this client.
|
66
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
67
|
+
# credentials for this client.
|
68
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
69
|
+
# credentials for this client.
|
70
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
71
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
72
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
73
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
74
|
+
# metadata for requests, generally, to give OAuth credentials.
|
75
|
+
# @param scopes [Array<String>]
|
76
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
77
|
+
# an updater_proc is supplied.
|
78
|
+
# @param client_config [Hash]
|
79
|
+
# A Hash for call options for each method. See
|
80
|
+
# Google::Gax#construct_settings for the structure of
|
81
|
+
# this data. Falls back to the default config if not specified
|
82
|
+
# or the specified config is missing data points.
|
83
|
+
# @param timeout [Numeric]
|
84
|
+
# The default timeout, in seconds, for calls made through this client.
|
85
|
+
# @param metadata [Hash]
|
86
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
87
|
+
# @param exception_transformer [Proc]
|
88
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
89
|
+
# custom error handling.
|
90
|
+
def initialize \
|
91
|
+
credentials: nil,
|
92
|
+
scopes: ALL_SCOPES,
|
93
|
+
client_config: {},
|
94
|
+
timeout: DEFAULT_TIMEOUT,
|
95
|
+
metadata: nil,
|
96
|
+
exception_transformer: nil,
|
97
|
+
lib_name: nil,
|
98
|
+
lib_version: ""
|
99
|
+
# These require statements are intentionally placed here to initialize
|
100
|
+
# the gRPC module only when it's required.
|
101
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
102
|
+
require "google/gax/grpc"
|
103
|
+
require "google/cloud/speech/v1p1beta1/cloud_speech_services_pb"
|
104
|
+
|
105
|
+
credentials ||= Google::Cloud::Speech::V1p1beta1::Credentials.default
|
106
|
+
|
107
|
+
@operations_client = OperationsClient.new(
|
108
|
+
credentials: credentials,
|
109
|
+
scopes: scopes,
|
110
|
+
client_config: client_config,
|
111
|
+
timeout: timeout,
|
112
|
+
lib_name: lib_name,
|
113
|
+
lib_version: lib_version,
|
114
|
+
)
|
115
|
+
|
116
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
117
|
+
updater_proc = Google::Cloud::Speech::V1p1beta1::Credentials.new(credentials).updater_proc
|
118
|
+
end
|
119
|
+
if credentials.is_a?(GRPC::Core::Channel)
|
120
|
+
channel = credentials
|
121
|
+
end
|
122
|
+
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
123
|
+
chan_creds = credentials
|
124
|
+
end
|
125
|
+
if credentials.is_a?(Proc)
|
126
|
+
updater_proc = credentials
|
127
|
+
end
|
128
|
+
if credentials.is_a?(Google::Auth::Credentials)
|
129
|
+
updater_proc = credentials.updater_proc
|
130
|
+
end
|
131
|
+
|
132
|
+
package_version = Gem.loaded_specs['google-cloud-speech'].version.version
|
133
|
+
|
134
|
+
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
135
|
+
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
136
|
+
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
137
|
+
google_api_client << " grpc/#{GRPC::VERSION}"
|
138
|
+
google_api_client.freeze
|
139
|
+
|
140
|
+
headers = { :"x-goog-api-client" => google_api_client }
|
141
|
+
headers.merge!(metadata) unless metadata.nil?
|
142
|
+
client_config_file = Pathname.new(__dir__).join(
|
143
|
+
"speech_client_config.json"
|
144
|
+
)
|
145
|
+
defaults = client_config_file.open do |f|
|
146
|
+
Google::Gax.construct_settings(
|
147
|
+
"google.cloud.speech.v1p1beta1.Speech",
|
148
|
+
JSON.parse(f.read),
|
149
|
+
client_config,
|
150
|
+
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
151
|
+
timeout,
|
152
|
+
errors: Google::Gax::Grpc::API_ERRORS,
|
153
|
+
metadata: headers
|
154
|
+
)
|
155
|
+
end
|
156
|
+
|
157
|
+
# Allow overriding the service path/port in subclasses.
|
158
|
+
service_path = self.class::SERVICE_ADDRESS
|
159
|
+
port = self.class::DEFAULT_SERVICE_PORT
|
160
|
+
@speech_stub = Google::Gax::Grpc.create_stub(
|
161
|
+
service_path,
|
162
|
+
port,
|
163
|
+
chan_creds: chan_creds,
|
164
|
+
channel: channel,
|
165
|
+
updater_proc: updater_proc,
|
166
|
+
scopes: scopes,
|
167
|
+
&Google::Cloud::Speech::V1p1beta1::Speech::Stub.method(:new)
|
168
|
+
)
|
169
|
+
|
170
|
+
@recognize = Google::Gax.create_api_call(
|
171
|
+
@speech_stub.method(:recognize),
|
172
|
+
defaults["recognize"],
|
173
|
+
exception_transformer: exception_transformer
|
174
|
+
)
|
175
|
+
@long_running_recognize = Google::Gax.create_api_call(
|
176
|
+
@speech_stub.method(:long_running_recognize),
|
177
|
+
defaults["long_running_recognize"],
|
178
|
+
exception_transformer: exception_transformer
|
179
|
+
)
|
180
|
+
@streaming_recognize = Google::Gax.create_api_call(
|
181
|
+
@speech_stub.method(:streaming_recognize),
|
182
|
+
defaults["streaming_recognize"],
|
183
|
+
exception_transformer: exception_transformer
|
184
|
+
)
|
185
|
+
end
|
186
|
+
|
187
|
+
# Service calls
|
188
|
+
|
189
|
+
# Performs synchronous speech recognition: receive results after all audio
|
190
|
+
# has been sent and processed.
|
191
|
+
#
|
192
|
+
# @param config [Google::Cloud::Speech::V1p1beta1::RecognitionConfig | Hash]
|
193
|
+
# *Required* Provides information to the recognizer that specifies how to
|
194
|
+
# process the request.
|
195
|
+
# A hash of the same form as `Google::Cloud::Speech::V1p1beta1::RecognitionConfig`
|
196
|
+
# can also be provided.
|
197
|
+
# @param audio [Google::Cloud::Speech::V1p1beta1::RecognitionAudio | Hash]
|
198
|
+
# *Required* The audio data to be recognized.
|
199
|
+
# A hash of the same form as `Google::Cloud::Speech::V1p1beta1::RecognitionAudio`
|
200
|
+
# can also be provided.
|
201
|
+
# @param options [Google::Gax::CallOptions]
|
202
|
+
# Overrides the default settings for this call, e.g, timeout,
|
203
|
+
# retries, etc.
|
204
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
205
|
+
# @yieldparam result [Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
206
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
207
|
+
# @return [Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
|
208
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
209
|
+
# @example
|
210
|
+
# require "google/cloud/speech/v1p1beta1"
|
211
|
+
#
|
212
|
+
# speech_client = Google::Cloud::Speech::V1p1beta1.new
|
213
|
+
# encoding = :FLAC
|
214
|
+
# sample_rate_hertz = 44100
|
215
|
+
# language_code = "en-US"
|
216
|
+
# config = {
|
217
|
+
# encoding: encoding,
|
218
|
+
# sample_rate_hertz: sample_rate_hertz,
|
219
|
+
# language_code: language_code
|
220
|
+
# }
|
221
|
+
# uri = "gs://bucket_name/file_name.flac"
|
222
|
+
# audio = { uri: uri }
|
223
|
+
# response = speech_client.recognize(config, audio)
|
224
|
+
|
225
|
+
def recognize \
|
226
|
+
config,
|
227
|
+
audio,
|
228
|
+
options: nil,
|
229
|
+
&block
|
230
|
+
req = {
|
231
|
+
config: config,
|
232
|
+
audio: audio
|
233
|
+
}.delete_if { |_, v| v.nil? }
|
234
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Speech::V1p1beta1::RecognizeRequest)
|
235
|
+
@recognize.call(req, options, &block)
|
236
|
+
end
|
237
|
+
|
238
|
+
# Performs asynchronous speech recognition: receive results via the
|
239
|
+
# google.longrunning.Operations interface. Returns either an
|
240
|
+
# +Operation.error+ or an +Operation.response+ which contains
|
241
|
+
# a +LongRunningRecognizeResponse+ message.
|
242
|
+
#
|
243
|
+
# @param config [Google::Cloud::Speech::V1p1beta1::RecognitionConfig | Hash]
|
244
|
+
# *Required* Provides information to the recognizer that specifies how to
|
245
|
+
# process the request.
|
246
|
+
# A hash of the same form as `Google::Cloud::Speech::V1p1beta1::RecognitionConfig`
|
247
|
+
# can also be provided.
|
248
|
+
# @param audio [Google::Cloud::Speech::V1p1beta1::RecognitionAudio | Hash]
|
249
|
+
# *Required* The audio data to be recognized.
|
250
|
+
# A hash of the same form as `Google::Cloud::Speech::V1p1beta1::RecognitionAudio`
|
251
|
+
# can also be provided.
|
252
|
+
# @param options [Google::Gax::CallOptions]
|
253
|
+
# Overrides the default settings for this call, e.g, timeout,
|
254
|
+
# retries, etc.
|
255
|
+
# @return [Google::Gax::Operation]
|
256
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
257
|
+
# @example
|
258
|
+
# require "google/cloud/speech/v1p1beta1"
|
259
|
+
#
|
260
|
+
# speech_client = Google::Cloud::Speech::V1p1beta1.new
|
261
|
+
# encoding = :FLAC
|
262
|
+
# sample_rate_hertz = 44100
|
263
|
+
# language_code = "en-US"
|
264
|
+
# config = {
|
265
|
+
# encoding: encoding,
|
266
|
+
# sample_rate_hertz: sample_rate_hertz,
|
267
|
+
# language_code: language_code
|
268
|
+
# }
|
269
|
+
# uri = "gs://bucket_name/file_name.flac"
|
270
|
+
# audio = { uri: uri }
|
271
|
+
#
|
272
|
+
# # Register a callback during the method call.
|
273
|
+
# operation = speech_client.long_running_recognize(config, audio) do |op|
|
274
|
+
# raise op.results.message if op.error?
|
275
|
+
# op_results = op.results
|
276
|
+
# # Process the results.
|
277
|
+
#
|
278
|
+
# metadata = op.metadata
|
279
|
+
# # Process the metadata.
|
280
|
+
# end
|
281
|
+
#
|
282
|
+
# # Or use the return value to register a callback.
|
283
|
+
# operation.on_done do |op|
|
284
|
+
# raise op.results.message if op.error?
|
285
|
+
# op_results = op.results
|
286
|
+
# # Process the results.
|
287
|
+
#
|
288
|
+
# metadata = op.metadata
|
289
|
+
# # Process the metadata.
|
290
|
+
# end
|
291
|
+
#
|
292
|
+
# # Manually reload the operation.
|
293
|
+
# operation.reload!
|
294
|
+
#
|
295
|
+
# # Or block until the operation completes, triggering callbacks on
|
296
|
+
# # completion.
|
297
|
+
# operation.wait_until_done!
|
298
|
+
|
299
|
+
def long_running_recognize \
|
300
|
+
config,
|
301
|
+
audio,
|
302
|
+
options: nil
|
303
|
+
req = {
|
304
|
+
config: config,
|
305
|
+
audio: audio
|
306
|
+
}.delete_if { |_, v| v.nil? }
|
307
|
+
req = Google::Gax::to_proto(req, Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest)
|
308
|
+
operation = Google::Gax::Operation.new(
|
309
|
+
@long_running_recognize.call(req, options),
|
310
|
+
@operations_client,
|
311
|
+
Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeResponse,
|
312
|
+
Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeMetadata,
|
313
|
+
call_options: options
|
314
|
+
)
|
315
|
+
operation.on_done { |operation| yield(operation) } if block_given?
|
316
|
+
operation
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"interfaces": {
|
3
|
+
"google.cloud.speech.v1p1beta1.Speech": {
|
4
|
+
"retry_codes": {
|
5
|
+
"idempotent": [
|
6
|
+
"DEADLINE_EXCEEDED",
|
7
|
+
"UNAVAILABLE"
|
8
|
+
],
|
9
|
+
"non_idempotent": []
|
10
|
+
},
|
11
|
+
"retry_params": {
|
12
|
+
"default": {
|
13
|
+
"initial_retry_delay_millis": 100,
|
14
|
+
"retry_delay_multiplier": 1.3,
|
15
|
+
"max_retry_delay_millis": 60000,
|
16
|
+
"initial_rpc_timeout_millis": 1000000,
|
17
|
+
"rpc_timeout_multiplier": 1.0,
|
18
|
+
"max_rpc_timeout_millis": 1000000,
|
19
|
+
"total_timeout_millis": 5000000
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"methods": {
|
23
|
+
"Recognize": {
|
24
|
+
"timeout_millis": 1000000,
|
25
|
+
"retry_codes_name": "idempotent",
|
26
|
+
"retry_params_name": "default"
|
27
|
+
},
|
28
|
+
"LongRunningRecognize": {
|
29
|
+
"timeout_millis": 60000,
|
30
|
+
"retry_codes_name": "non_idempotent",
|
31
|
+
"retry_params_name": "default"
|
32
|
+
},
|
33
|
+
"StreamingRecognize": {
|
34
|
+
"timeout_millis": 1000000,
|
35
|
+
"retry_codes_name": "idempotent",
|
36
|
+
"retry_params_name": "default"
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|