Skip to content

Commit 3d11c49

Browse files
feat: added Speech-to-Text V2 API (#447)
* build: enable Speech v2 client library generation PiperOrigin-RevId: 477910378 Source-Link: googleapis/googleapis@3fde7ab Source-Link: https://github.com/googleapis/googleapis-gen/commit/636957906cc7868065a50cef61f5e995a75ae3e6 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjM2OTU3OTA2Y2M3ODY4MDY1YTUwY2VmNjFmNWU5OTVhNzVhZTNlNiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: regenerate docs/index.rst * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent b9ee866 commit 3d11c49

File tree

47 files changed

+6383
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6383
-0
lines changed

speech/generated_samples/snippet_metadata_speech_v2.json

Lines changed: 3845 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for BatchRecognize
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-speech
24+
25+
26+
# [START speech_v2_generated_Speech_BatchRecognize_async]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import speech_v2
35+
36+
37+
async def sample_batch_recognize():
38+
# Create a client
39+
client = speech_v2.SpeechAsyncClient()
40+
41+
# Initialize request argument(s)
42+
request = speech_v2.BatchRecognizeRequest(
43+
recognizer="recognizer_value",
44+
)
45+
46+
# Make the request
47+
operation = client.batch_recognize(request=request)
48+
49+
print("Waiting for operation to complete...")
50+
51+
response = await operation.result()
52+
53+
# Handle the response
54+
print(response)
55+
56+
# [END speech_v2_generated_Speech_BatchRecognize_async]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for BatchRecognize
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-speech
24+
25+
26+
# [START speech_v2_generated_Speech_BatchRecognize_sync]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import speech_v2
35+
36+
37+
def sample_batch_recognize():
38+
# Create a client
39+
client = speech_v2.SpeechClient()
40+
41+
# Initialize request argument(s)
42+
request = speech_v2.BatchRecognizeRequest(
43+
recognizer="recognizer_value",
44+
)
45+
46+
# Make the request
47+
operation = client.batch_recognize(request=request)
48+
49+
print("Waiting for operation to complete...")
50+
51+
response = operation.result()
52+
53+
# Handle the response
54+
print(response)
55+
56+
# [END speech_v2_generated_Speech_BatchRecognize_sync]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for CreateCustomClass
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-speech
24+
25+
26+
# [START speech_v2_generated_Speech_CreateCustomClass_async]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import speech_v2
35+
36+
37+
async def sample_create_custom_class():
38+
# Create a client
39+
client = speech_v2.SpeechAsyncClient()
40+
41+
# Initialize request argument(s)
42+
request = speech_v2.CreateCustomClassRequest(
43+
parent="parent_value",
44+
)
45+
46+
# Make the request
47+
operation = client.create_custom_class(request=request)
48+
49+
print("Waiting for operation to complete...")
50+
51+
response = await operation.result()
52+
53+
# Handle the response
54+
print(response)
55+
56+
# [END speech_v2_generated_Speech_CreateCustomClass_async]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for CreateCustomClass
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-speech
24+
25+
26+
# [START speech_v2_generated_Speech_CreateCustomClass_sync]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import speech_v2
35+
36+
37+
def sample_create_custom_class():
38+
# Create a client
39+
client = speech_v2.SpeechClient()
40+
41+
# Initialize request argument(s)
42+
request = speech_v2.CreateCustomClassRequest(
43+
parent="parent_value",
44+
)
45+
46+
# Make the request
47+
operation = client.create_custom_class(request=request)
48+
49+
print("Waiting for operation to complete...")
50+
51+
response = operation.result()
52+
53+
# Handle the response
54+
print(response)
55+
56+
# [END speech_v2_generated_Speech_CreateCustomClass_sync]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for CreatePhraseSet
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-speech
24+
25+
26+
# [START speech_v2_generated_Speech_CreatePhraseSet_async]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import speech_v2
35+
36+
37+
async def sample_create_phrase_set():
38+
# Create a client
39+
client = speech_v2.SpeechAsyncClient()
40+
41+
# Initialize request argument(s)
42+
request = speech_v2.CreatePhraseSetRequest(
43+
parent="parent_value",
44+
)
45+
46+
# Make the request
47+
operation = client.create_phrase_set(request=request)
48+
49+
print("Waiting for operation to complete...")
50+
51+
response = await operation.result()
52+
53+
# Handle the response
54+
print(response)
55+
56+
# [END speech_v2_generated_Speech_CreatePhraseSet_async]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for CreatePhraseSet
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-speech
24+
25+
26+
# [START speech_v2_generated_Speech_CreatePhraseSet_sync]
27+
# This snippet has been automatically generated and should be regarded as a
28+
# code template only.
29+
# It will require modifications to work:
30+
# - It may require correct/in-range values for request initialization.
31+
# - It may require specifying regional endpoints when creating the service
32+
# client as shown in:
33+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
34+
from google.cloud import speech_v2
35+
36+
37+
def sample_create_phrase_set():
38+
# Create a client
39+
client = speech_v2.SpeechClient()
40+
41+
# Initialize request argument(s)
42+
request = speech_v2.CreatePhraseSetRequest(
43+
parent="parent_value",
44+
)
45+
46+
# Make the request
47+
operation = client.create_phrase_set(request=request)
48+
49+
print("Waiting for operation to complete...")
50+
51+
response = operation.result()
52+
53+
# Handle the response
54+
print(response)
55+
56+
# [END speech_v2_generated_Speech_CreatePhraseSet_sync]

0 commit comments

Comments
 (0)