google-cloud-speech-v1p1beta1 0.15.3 → 0.17.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.
@@ -0,0 +1,164 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/speech/v1p1beta1/cloud_speech_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Speech
24
+ module V1p1beta1
25
+ module Speech
26
+ module Rest
27
+ ##
28
+ # REST service stub for the Speech service.
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
+ #
32
+ class ServiceStub
33
+ def initialize endpoint:, credentials:
34
+ # These require statements are intentionally placed here to initialize
35
+ # the REST modules only when it's required.
36
+ require "gapic/rest"
37
+
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
39
+ numeric_enums: true,
40
+ raise_faraday_errors: false
41
+ end
42
+
43
+ ##
44
+ # Baseline implementation for the recognize REST call
45
+ #
46
+ # @param request_pb [::Google::Cloud::Speech::V1p1beta1::RecognizeRequest]
47
+ # A request object representing the call parameters. Required.
48
+ # @param options [::Gapic::CallOptions]
49
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
50
+ #
51
+ # @yield [result, operation] Access the result along with the TransportOperation object
52
+ # @yieldparam result [::Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::Speech::V1p1beta1::RecognizeResponse]
56
+ # A result object deserialized from the server's reply
57
+ def recognize request_pb, options = nil
58
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
59
+
60
+ verb, uri, query_string_params, body = ServiceStub.transcode_recognize_request request_pb
61
+ query_string_params = if query_string_params.any?
62
+ query_string_params.to_h { |p| p.split("=", 2) }
63
+ else
64
+ {}
65
+ end
66
+
67
+ response = @client_stub.make_http_request(
68
+ verb,
69
+ uri: uri,
70
+ body: body || "",
71
+ params: query_string_params,
72
+ options: options
73
+ )
74
+ operation = ::Gapic::Rest::TransportOperation.new response
75
+ result = ::Google::Cloud::Speech::V1p1beta1::RecognizeResponse.decode_json response.body, ignore_unknown_fields: true
76
+
77
+ yield result, operation if block_given?
78
+ result
79
+ end
80
+
81
+ ##
82
+ # Baseline implementation for the long_running_recognize REST call
83
+ #
84
+ # @param request_pb [::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest]
85
+ # A request object representing the call parameters. Required.
86
+ # @param options [::Gapic::CallOptions]
87
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
88
+ #
89
+ # @yield [result, operation] Access the result along with the TransportOperation object
90
+ # @yieldparam result [::Google::Longrunning::Operation]
91
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
92
+ #
93
+ # @return [::Google::Longrunning::Operation]
94
+ # A result object deserialized from the server's reply
95
+ def long_running_recognize request_pb, options = nil
96
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
97
+
98
+ verb, uri, query_string_params, body = ServiceStub.transcode_long_running_recognize_request request_pb
99
+ query_string_params = if query_string_params.any?
100
+ query_string_params.to_h { |p| p.split("=", 2) }
101
+ else
102
+ {}
103
+ end
104
+
105
+ response = @client_stub.make_http_request(
106
+ verb,
107
+ uri: uri,
108
+ body: body || "",
109
+ params: query_string_params,
110
+ options: options
111
+ )
112
+ operation = ::Gapic::Rest::TransportOperation.new response
113
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
114
+
115
+ yield result, operation if block_given?
116
+ result
117
+ end
118
+
119
+ ##
120
+ # @private
121
+ #
122
+ # GRPC transcoding helper method for the recognize REST call
123
+ #
124
+ # @param request_pb [::Google::Cloud::Speech::V1p1beta1::RecognizeRequest]
125
+ # A request object representing the call parameters. Required.
126
+ # @return [Array(String, [String, nil], Hash{String => String})]
127
+ # Uri, Body, Query string parameters
128
+ def self.transcode_recognize_request request_pb
129
+ transcoder = Gapic::Rest::GrpcTranscoder.new
130
+ .with_bindings(
131
+ uri_method: :post,
132
+ uri_template: "/v1p1beta1/speech:recognize",
133
+ body: "*",
134
+ matches: []
135
+ )
136
+ transcoder.transcode request_pb
137
+ end
138
+
139
+ ##
140
+ # @private
141
+ #
142
+ # GRPC transcoding helper method for the long_running_recognize REST call
143
+ #
144
+ # @param request_pb [::Google::Cloud::Speech::V1p1beta1::LongRunningRecognizeRequest]
145
+ # A request object representing the call parameters. Required.
146
+ # @return [Array(String, [String, nil], Hash{String => String})]
147
+ # Uri, Body, Query string parameters
148
+ def self.transcode_long_running_recognize_request request_pb
149
+ transcoder = Gapic::Rest::GrpcTranscoder.new
150
+ .with_bindings(
151
+ uri_method: :post,
152
+ uri_template: "/v1p1beta1/speech:longrunningrecognize",
153
+ body: "*",
154
+ matches: []
155
+ )
156
+ transcoder.transcode request_pb
157
+ end
158
+ end
159
+ end
160
+ end
161
+ end
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/speech/v1p1beta1/version"
24
+
25
+ require "google/cloud/speech/v1p1beta1/speech/credentials"
26
+ require "google/cloud/speech/v1p1beta1/speech/paths"
27
+ require "google/cloud/speech/v1p1beta1/speech/rest/operations"
28
+ require "google/cloud/speech/v1p1beta1/speech/rest/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Speech
33
+ module V1p1beta1
34
+ ##
35
+ # Service that implements Google Cloud Speech API.
36
+ #
37
+ # To load this service and instantiate a REST client:
38
+ #
39
+ # require "google/cloud/speech/v1p1beta1/speech/rest"
40
+ # client = ::Google::Cloud::Speech::V1p1beta1::Speech::Rest::Client.new
41
+ #
42
+ module Speech
43
+ # Client for the REST transport
44
+ module Rest
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
53
+ require "google/cloud/speech/v1p1beta1/speech/rest/helpers" if ::File.file? helper_path
@@ -26,6 +26,7 @@ require "google/cloud/speech/v1p1beta1/speech/credentials"
26
26
  require "google/cloud/speech/v1p1beta1/speech/paths"
27
27
  require "google/cloud/speech/v1p1beta1/speech/operations"
28
28
  require "google/cloud/speech/v1p1beta1/speech/client"
29
+ require "google/cloud/speech/v1p1beta1/speech/rest"
29
30
 
30
31
  module Google
31
32
  module Cloud
@@ -39,6 +40,11 @@ module Google
39
40
  # require "google/cloud/speech/v1p1beta1/speech"
40
41
  # client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
41
42
  #
43
+ # @example Load this service and instantiate a REST client
44
+ #
45
+ # require "google/cloud/speech/v1p1beta1/speech/rest"
46
+ # client = ::Google::Cloud::Speech::V1p1beta1::Speech::Rest::Client.new
47
+ #
42
48
  module Speech
43
49
  end
44
50
  end
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Speech
23
23
  module V1p1beta1
24
- VERSION = "0.15.3"
24
+ VERSION = "0.17.0"
25
25
  end
26
26
  end
27
27
  end
@@ -31,6 +31,11 @@ module Google
31
31
  # require "google/cloud/speech/v1p1beta1"
32
32
  # client = ::Google::Cloud::Speech::V1p1beta1::Speech::Client.new
33
33
  #
34
+ # @example Load this package, including all its services, and instantiate a REST client
35
+ #
36
+ # require "google/cloud/speech/v1p1beta1"
37
+ # client = ::Google::Cloud::Speech::V1p1beta1::Speech::Rest::Client.new
38
+ #
34
39
  module V1p1beta1
35
40
  end
36
41
  end
@@ -122,9 +122,30 @@ module Google
122
122
  # returned as they become available (these interim results are indicated with
123
123
  # the `is_final=false` flag).
124
124
  # If `false` or omitted, only `is_final=true` result(s) are returned.
125
+ # @!attribute [rw] enable_voice_activity_events
126
+ # @return [::Boolean]
127
+ # If `true`, responses with voice activity speech events will be returned as
128
+ # they are detected.
129
+ # @!attribute [rw] voice_activity_timeout
130
+ # @return [::Google::Cloud::Speech::V1p1beta1::StreamingRecognitionConfig::VoiceActivityTimeout]
131
+ # If set, the server will automatically close the stream after the specified
132
+ # duration has elapsed after the last VOICE_ACTIVITY speech event has been
133
+ # sent. The field `voice_activity_events` must also be set to true.
125
134
  class StreamingRecognitionConfig
126
135
  include ::Google::Protobuf::MessageExts
127
136
  extend ::Google::Protobuf::MessageExts::ClassMethods
137
+
138
+ # Events that a timeout can be set on for voice activity.
139
+ # @!attribute [rw] speech_start_timeout
140
+ # @return [::Google::Protobuf::Duration]
141
+ # Duration to timeout the stream if no speech begins.
142
+ # @!attribute [rw] speech_end_timeout
143
+ # @return [::Google::Protobuf::Duration]
144
+ # Duration to timeout the stream after speech ends.
145
+ class VoiceActivityTimeout
146
+ include ::Google::Protobuf::MessageExts
147
+ extend ::Google::Protobuf::MessageExts::ClassMethods
148
+ end
128
149
  end
129
150
 
130
151
  # Provides information to the recognizer that specifies how to process the
@@ -133,7 +154,8 @@ module Google
133
154
  # @return [::Google::Cloud::Speech::V1p1beta1::RecognitionConfig::AudioEncoding]
134
155
  # Encoding of audio data sent in all `RecognitionAudio` messages.
135
156
  # This field is optional for `FLAC` and `WAV` audio files and required
136
- # for all other audio formats. For details, see {::Google::Cloud::Speech::V1p1beta1::RecognitionConfig::AudioEncoding AudioEncoding}.
157
+ # for all other audio formats. For details, see
158
+ # {::Google::Cloud::Speech::V1p1beta1::RecognitionConfig::AudioEncoding AudioEncoding}.
137
159
  # @!attribute [rw] sample_rate_hertz
138
160
  # @return [::Integer]
139
161
  # Sample rate in Hertz of the audio data sent in all
@@ -142,7 +164,8 @@ module Google
142
164
  # source to 16000 Hz. If that's not possible, use the native sample rate of
143
165
  # the audio source (instead of re-sampling).
144
166
  # This field is optional for FLAC and WAV audio files, but is
145
- # required for all other audio formats. For details, see {::Google::Cloud::Speech::V1p1beta1::RecognitionConfig::AudioEncoding AudioEncoding}.
167
+ # required for all other audio formats. For details, see
168
+ # {::Google::Cloud::Speech::V1p1beta1::RecognitionConfig::AudioEncoding AudioEncoding}.
146
169
  # @!attribute [rw] audio_channel_count
147
170
  # @return [::Integer]
148
171
  # The number of channels in the input audio data.
@@ -363,7 +386,8 @@ module Google
363
386
  # an `AudioEncoding` when you send send `FLAC` or `WAV` audio, the
364
387
  # encoding configuration must match the encoding described in the audio
365
388
  # header; otherwise the request returns an
366
- # [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error code.
389
+ # [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error
390
+ # code.
367
391
  module AudioEncoding
368
392
  # Not specified.
369
393
  ENCODING_UNSPECIFIED = 0
@@ -612,8 +636,8 @@ module Google
612
636
 
613
637
  # Contains audio data in the encoding specified in the `RecognitionConfig`.
614
638
  # Either `content` or `uri` must be supplied. Supplying both or neither
615
- # returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. See
616
- # [content limits](https://cloud.google.com/speech-to-text/quotas#content).
639
+ # returns [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT].
640
+ # See [content limits](https://cloud.google.com/speech-to-text/quotas#content).
617
641
  # @!attribute [rw] content
618
642
  # @return [::String]
619
643
  # The audio data bytes encoded as specified in
@@ -626,8 +650,9 @@ module Google
626
650
  # Currently, only Google Cloud Storage URIs are
627
651
  # supported, which must be specified in the following format:
628
652
  # `gs://bucket_name/object_name` (other URI formats return
629
- # [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see
630
- # [Request URIs](https://cloud.google.com/storage/docs/reference-uris).
653
+ # [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]).
654
+ # For more information, see [Request
655
+ # URIs](https://cloud.google.com/storage/docs/reference-uris).
631
656
  class RecognitionAudio
632
657
  include ::Google::Protobuf::MessageExts
633
658
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -700,11 +725,12 @@ module Google
700
725
  # Time of the most recent processing update.
701
726
  # @!attribute [r] uri
702
727
  # @return [::String]
703
- # Output only. The URI of the audio file being transcribed. Empty if the audio was sent
704
- # as byte content.
728
+ # Output only. The URI of the audio file being transcribed. Empty if the
729
+ # audio was sent as byte content.
705
730
  # @!attribute [r] output_config
706
731
  # @return [::Google::Cloud::Speech::V1p1beta1::TranscriptOutputConfig]
707
- # Output only. A copy of the TranscriptOutputConfig if it was set in the request.
732
+ # Output only. A copy of the TranscriptOutputConfig if it was set in the
733
+ # request.
708
734
  class LongRunningRecognizeMetadata
709
735
  include ::Google::Protobuf::MessageExts
710
736
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -772,6 +798,9 @@ module Google
772
798
  # @!attribute [rw] speech_event_type
773
799
  # @return [::Google::Cloud::Speech::V1p1beta1::StreamingRecognizeResponse::SpeechEventType]
774
800
  # Indicates the type of speech event.
801
+ # @!attribute [rw] speech_event_time
802
+ # @return [::Google::Protobuf::Duration]
803
+ # Time offset between the beginning of the audio and event emission.
775
804
  # @!attribute [rw] total_billed_time
776
805
  # @return [::Google::Protobuf::Duration]
777
806
  # When available, billed audio seconds for the stream.
@@ -800,6 +829,23 @@ module Google
800
829
  # until the server closes the gRPC connection. This event is only sent if
801
830
  # `single_utterance` was set to `true`, and is not used otherwise.
802
831
  END_OF_SINGLE_UTTERANCE = 1
832
+
833
+ # This event indicates that the server has detected the beginning of human
834
+ # voice activity in the stream. This event can be returned multiple times
835
+ # if speech starts and stops repeatedly throughout the stream. This event
836
+ # is only sent if `voice_activity_events` is set to true.
837
+ SPEECH_ACTIVITY_BEGIN = 2
838
+
839
+ # This event indicates that the server has detected the end of human voice
840
+ # activity in the stream. This event can be returned multiple times if
841
+ # speech starts and stops repeatedly throughout the stream. This event is
842
+ # only sent if `voice_activity_events` is set to true.
843
+ SPEECH_ACTIVITY_END = 3
844
+
845
+ # This event indicates that the user-set timeout for speech activity begin
846
+ # or end has exceeded. Upon receiving this event, the client is expected to
847
+ # send a half close. Further audio will not be processed.
848
+ SPEECH_ACTIVITY_TIMEOUT = 4
803
849
  end
804
850
  end
805
851
 
@@ -836,9 +882,9 @@ module Google
836
882
  # For audio_channel_count = N, its output values can range from '1' to 'N'.
837
883
  # @!attribute [r] language_code
838
884
  # @return [::String]
839
- # Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag
840
- # of the language in this result. This language code was detected to have
841
- # the most likelihood of being spoken in the audio.
885
+ # Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
886
+ # language tag of the language in this result. This language code was
887
+ # detected to have the most likelihood of being spoken in the audio.
842
888
  class StreamingRecognitionResult
843
889
  include ::Google::Protobuf::MessageExts
844
890
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -862,9 +908,9 @@ module Google
862
908
  # beginning of the audio.
863
909
  # @!attribute [r] language_code
864
910
  # @return [::String]
865
- # Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag
866
- # of the language in this result. This language code was detected to have
867
- # the most likelihood of being spoken in the audio.
911
+ # Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
912
+ # language tag of the language in this result. This language code was
913
+ # detected to have the most likelihood of being spoken in the audio.
868
914
  class SpeechRecognitionResult
869
915
  include ::Google::Protobuf::MessageExts
870
916
  extend ::Google::Protobuf::MessageExts::ClassMethods
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-speech-v1p1beta1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.3
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-17 00:00:00.000000000 Z
11
+ date: 2023-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.17.1
19
+ version: 0.18.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.a
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.17.1
29
+ version: 0.18.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a
@@ -179,16 +179,24 @@ files:
179
179
  - lib/google/cloud/speech/v1p1beta1/adaptation/client.rb
180
180
  - lib/google/cloud/speech/v1p1beta1/adaptation/credentials.rb
181
181
  - lib/google/cloud/speech/v1p1beta1/adaptation/paths.rb
182
+ - lib/google/cloud/speech/v1p1beta1/adaptation/rest.rb
183
+ - lib/google/cloud/speech/v1p1beta1/adaptation/rest/client.rb
184
+ - lib/google/cloud/speech/v1p1beta1/adaptation/rest/service_stub.rb
182
185
  - lib/google/cloud/speech/v1p1beta1/cloud_speech_adaptation_pb.rb
183
186
  - lib/google/cloud/speech/v1p1beta1/cloud_speech_adaptation_services_pb.rb
184
187
  - lib/google/cloud/speech/v1p1beta1/cloud_speech_pb.rb
185
188
  - lib/google/cloud/speech/v1p1beta1/cloud_speech_services_pb.rb
186
189
  - lib/google/cloud/speech/v1p1beta1/resource_pb.rb
190
+ - lib/google/cloud/speech/v1p1beta1/rest.rb
187
191
  - lib/google/cloud/speech/v1p1beta1/speech.rb
188
192
  - lib/google/cloud/speech/v1p1beta1/speech/client.rb
189
193
  - lib/google/cloud/speech/v1p1beta1/speech/credentials.rb
190
194
  - lib/google/cloud/speech/v1p1beta1/speech/operations.rb
191
195
  - lib/google/cloud/speech/v1p1beta1/speech/paths.rb
196
+ - lib/google/cloud/speech/v1p1beta1/speech/rest.rb
197
+ - lib/google/cloud/speech/v1p1beta1/speech/rest/client.rb
198
+ - lib/google/cloud/speech/v1p1beta1/speech/rest/operations.rb
199
+ - lib/google/cloud/speech/v1p1beta1/speech/rest/service_stub.rb
192
200
  - lib/google/cloud/speech/v1p1beta1/version.rb
193
201
  - proto_docs/README.md
194
202
  - proto_docs/google/api/client.rb
@@ -228,5 +236,5 @@ requirements: []
228
236
  rubygems_version: 3.4.2
229
237
  signing_key:
230
238
  specification_version: 4
231
- summary: API Client library for the Cloud Speech-to-Text V1p1beta1 API
239
+ summary: Converts audio to text by applying powerful neural network models.
232
240
  test_files: []