-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: googleapis/googleapis-gen@6369579 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 <partheniou@google.com>
- Loading branch information
Showing
47 changed files
with
6,383 additions
and
0 deletions.
There are no files selected for viewing
3,845 changes: 3,845 additions & 0 deletions
3,845
speech/generated_samples/snippet_metadata_speech_v2.json
Large diffs are not rendered by default.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
speech/generated_samples/speech_v2_generated_speech_batch_recognize_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Generated code. DO NOT EDIT! | ||
# | ||
# Snippet for BatchRecognize | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-speech | ||
|
||
|
||
# [START speech_v2_generated_Speech_BatchRecognize_async] | ||
# This snippet has been automatically generated and should be regarded as a | ||
# code template only. | ||
# It will require modifications to work: | ||
# - It may require correct/in-range values for request initialization. | ||
# - It may require specifying regional endpoints when creating the service | ||
# client as shown in: | ||
# https://googleapis.dev/python/google-api-core/latest/client_options.html | ||
from google.cloud import speech_v2 | ||
|
||
|
||
async def sample_batch_recognize(): | ||
# Create a client | ||
client = speech_v2.SpeechAsyncClient() | ||
|
||
# Initialize request argument(s) | ||
request = speech_v2.BatchRecognizeRequest( | ||
recognizer="recognizer_value", | ||
) | ||
|
||
# Make the request | ||
operation = client.batch_recognize(request=request) | ||
|
||
print("Waiting for operation to complete...") | ||
|
||
response = await operation.result() | ||
|
||
# Handle the response | ||
print(response) | ||
|
||
# [END speech_v2_generated_Speech_BatchRecognize_async] |
56 changes: 56 additions & 0 deletions
56
speech/generated_samples/speech_v2_generated_speech_batch_recognize_sync.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Generated code. DO NOT EDIT! | ||
# | ||
# Snippet for BatchRecognize | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-speech | ||
|
||
|
||
# [START speech_v2_generated_Speech_BatchRecognize_sync] | ||
# This snippet has been automatically generated and should be regarded as a | ||
# code template only. | ||
# It will require modifications to work: | ||
# - It may require correct/in-range values for request initialization. | ||
# - It may require specifying regional endpoints when creating the service | ||
# client as shown in: | ||
# https://googleapis.dev/python/google-api-core/latest/client_options.html | ||
from google.cloud import speech_v2 | ||
|
||
|
||
def sample_batch_recognize(): | ||
# Create a client | ||
client = speech_v2.SpeechClient() | ||
|
||
# Initialize request argument(s) | ||
request = speech_v2.BatchRecognizeRequest( | ||
recognizer="recognizer_value", | ||
) | ||
|
||
# Make the request | ||
operation = client.batch_recognize(request=request) | ||
|
||
print("Waiting for operation to complete...") | ||
|
||
response = operation.result() | ||
|
||
# Handle the response | ||
print(response) | ||
|
||
# [END speech_v2_generated_Speech_BatchRecognize_sync] |
56 changes: 56 additions & 0 deletions
56
speech/generated_samples/speech_v2_generated_speech_create_custom_class_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Generated code. DO NOT EDIT! | ||
# | ||
# Snippet for CreateCustomClass | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-speech | ||
|
||
|
||
# [START speech_v2_generated_Speech_CreateCustomClass_async] | ||
# This snippet has been automatically generated and should be regarded as a | ||
# code template only. | ||
# It will require modifications to work: | ||
# - It may require correct/in-range values for request initialization. | ||
# - It may require specifying regional endpoints when creating the service | ||
# client as shown in: | ||
# https://googleapis.dev/python/google-api-core/latest/client_options.html | ||
from google.cloud import speech_v2 | ||
|
||
|
||
async def sample_create_custom_class(): | ||
# Create a client | ||
client = speech_v2.SpeechAsyncClient() | ||
|
||
# Initialize request argument(s) | ||
request = speech_v2.CreateCustomClassRequest( | ||
parent="parent_value", | ||
) | ||
|
||
# Make the request | ||
operation = client.create_custom_class(request=request) | ||
|
||
print("Waiting for operation to complete...") | ||
|
||
response = await operation.result() | ||
|
||
# Handle the response | ||
print(response) | ||
|
||
# [END speech_v2_generated_Speech_CreateCustomClass_async] |
56 changes: 56 additions & 0 deletions
56
speech/generated_samples/speech_v2_generated_speech_create_custom_class_sync.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Generated code. DO NOT EDIT! | ||
# | ||
# Snippet for CreateCustomClass | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-speech | ||
|
||
|
||
# [START speech_v2_generated_Speech_CreateCustomClass_sync] | ||
# This snippet has been automatically generated and should be regarded as a | ||
# code template only. | ||
# It will require modifications to work: | ||
# - It may require correct/in-range values for request initialization. | ||
# - It may require specifying regional endpoints when creating the service | ||
# client as shown in: | ||
# https://googleapis.dev/python/google-api-core/latest/client_options.html | ||
from google.cloud import speech_v2 | ||
|
||
|
||
def sample_create_custom_class(): | ||
# Create a client | ||
client = speech_v2.SpeechClient() | ||
|
||
# Initialize request argument(s) | ||
request = speech_v2.CreateCustomClassRequest( | ||
parent="parent_value", | ||
) | ||
|
||
# Make the request | ||
operation = client.create_custom_class(request=request) | ||
|
||
print("Waiting for operation to complete...") | ||
|
||
response = operation.result() | ||
|
||
# Handle the response | ||
print(response) | ||
|
||
# [END speech_v2_generated_Speech_CreateCustomClass_sync] |
56 changes: 56 additions & 0 deletions
56
speech/generated_samples/speech_v2_generated_speech_create_phrase_set_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Generated code. DO NOT EDIT! | ||
# | ||
# Snippet for CreatePhraseSet | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-speech | ||
|
||
|
||
# [START speech_v2_generated_Speech_CreatePhraseSet_async] | ||
# This snippet has been automatically generated and should be regarded as a | ||
# code template only. | ||
# It will require modifications to work: | ||
# - It may require correct/in-range values for request initialization. | ||
# - It may require specifying regional endpoints when creating the service | ||
# client as shown in: | ||
# https://googleapis.dev/python/google-api-core/latest/client_options.html | ||
from google.cloud import speech_v2 | ||
|
||
|
||
async def sample_create_phrase_set(): | ||
# Create a client | ||
client = speech_v2.SpeechAsyncClient() | ||
|
||
# Initialize request argument(s) | ||
request = speech_v2.CreatePhraseSetRequest( | ||
parent="parent_value", | ||
) | ||
|
||
# Make the request | ||
operation = client.create_phrase_set(request=request) | ||
|
||
print("Waiting for operation to complete...") | ||
|
||
response = await operation.result() | ||
|
||
# Handle the response | ||
print(response) | ||
|
||
# [END speech_v2_generated_Speech_CreatePhraseSet_async] |
56 changes: 56 additions & 0 deletions
56
speech/generated_samples/speech_v2_generated_speech_create_phrase_set_sync.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2022 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Generated code. DO NOT EDIT! | ||
# | ||
# Snippet for CreatePhraseSet | ||
# NOTE: This snippet has been automatically generated for illustrative purposes only. | ||
# It may require modifications to work in your environment. | ||
|
||
# To install the latest published package dependency, execute the following: | ||
# python3 -m pip install google-cloud-speech | ||
|
||
|
||
# [START speech_v2_generated_Speech_CreatePhraseSet_sync] | ||
# This snippet has been automatically generated and should be regarded as a | ||
# code template only. | ||
# It will require modifications to work: | ||
# - It may require correct/in-range values for request initialization. | ||
# - It may require specifying regional endpoints when creating the service | ||
# client as shown in: | ||
# https://googleapis.dev/python/google-api-core/latest/client_options.html | ||
from google.cloud import speech_v2 | ||
|
||
|
||
def sample_create_phrase_set(): | ||
# Create a client | ||
client = speech_v2.SpeechClient() | ||
|
||
# Initialize request argument(s) | ||
request = speech_v2.CreatePhraseSetRequest( | ||
parent="parent_value", | ||
) | ||
|
||
# Make the request | ||
operation = client.create_phrase_set(request=request) | ||
|
||
print("Waiting for operation to complete...") | ||
|
||
response = operation.result() | ||
|
||
# Handle the response | ||
print(response) | ||
|
||
# [END speech_v2_generated_Speech_CreatePhraseSet_sync] |
Oops, something went wrong.