diff --git a/packages/google-cloud-speech/.github/.OwlBot.yaml b/packages/google-cloud-speech/.github/.OwlBot.yaml new file mode 100644 index 00000000000..1e38ece9ed4 --- /dev/null +++ b/packages/google-cloud-speech/.github/.OwlBot.yaml @@ -0,0 +1,25 @@ +# Copyright 2021 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. +docker: + image: gcr.io/repo-automation-bots/owlbot-nodejs:latest + +deep-remove-regex: + - /owl-bot-staging + +deep-copy-regex: + - source: /google/cloud/speech/(v.*)/.*-nodejs/(.*) + dest: /owl-bot-staging/$1/$2 + +begin-after-commit-hash: f43939eac6a0bb5998c1fa0f79063194e699230e + diff --git a/packages/google-cloud-speech/.repo-metadata.json b/packages/google-cloud-speech/.repo-metadata.json index 94d81e73009..33eb0b615c9 100644 --- a/packages/google-cloud-speech/.repo-metadata.json +++ b/packages/google-cloud-speech/.repo-metadata.json @@ -10,5 +10,6 @@ "distribution_name": "@google-cloud/speech", "api_id": "speech.googleapis.com", "requires_billing": false, - "codeowner_team": "@googleapis/ml-apis" + "codeowner_team": "@googleapis/ml-apis", + "default_version": "v1" } diff --git a/packages/google-cloud-speech/README.md b/packages/google-cloud-speech/README.md index dd986d3b9bb..066d509148c 100644 --- a/packages/google-cloud-speech/README.md +++ b/packages/google-cloud-speech/README.md @@ -103,6 +103,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-speech/tree | Microphone stream | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/MicrophoneStream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/MicrophoneStream.js,samples/README.md) | | Beta Features | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/betaFeatures.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/betaFeatures.js,samples/README.md) | | Infinite Streaming | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/infiniteStreaming.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/infiniteStreaming.js,samples/README.md) | +| Model Adaptation | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/modelAdaptation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/modelAdaptation.js,samples/README.md) | | Multi Region | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/multiRegion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/multiRegion.js,samples/README.md) | | Profanity Filter | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/profanityFilter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/profanityFilter.js,samples/README.md) | | Quickstart | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) | diff --git a/packages/google-cloud-speech/synth.py b/packages/google-cloud-speech/owlbot.py similarity index 58% rename from packages/google-cloud-speech/synth.py rename to packages/google-cloud-speech/owlbot.py index d2c07333a43..bb21bbcb4a1 100644 --- a/packages/google-cloud-speech/synth.py +++ b/packages/google-cloud-speech/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2018 Google LLC +# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -11,47 +11,28 @@ # 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. - """This script is used to synthesize generated parts of this library.""" +import os import synthtool as s import synthtool.gcp as gcp import synthtool.languages.node as node +import json import logging +from pathlib import Path -logging.basicConfig(level=logging.DEBUG) - -AUTOSYNTH_MULTIPLE_COMMITS = True - - -gapic = gcp.GAPICBazel() -common_templates = gcp.CommonTemplates() - -versions = ['v1p1beta1', 'v1'] -name = 'speech' - -for version in versions: - library = gapic.node_library(name, version) - - # skip index, protos, package.json, and README.md - s.copy( - library, - excludes=['package.json', 'src/index.ts',] - ) - +def patch(library: Path): + version = library.parts[len(library.parts) - 1] + name = 'speech' # Manual helper methods override the streaming API so that it # accepts streamingConfig when calling streamingRecognize. # Rename the generated methods to avoid confusion. - s.replace(f'src/{version}/{name}_client.ts', r'( +)streamingRecognize\(', '\\1_streamingRecognize(') - s.replace(f'test/gapic_{name}_{version}.ts', r'client\.streamingRecognize\(', 'client._streamingRecognize(') - s.replace(f'src/{version}/{name}_client.ts', r'\Z', + s.replace(f'owl-bot-staging/{version}/src/{version}/{name}_client.ts', r'( +)streamingRecognize\(', '\\1_streamingRecognize(') + s.replace(f'owl-bot-staging/{version}/test/gapic_{name}_{version}.ts', r'client\.streamingRecognize\(', 'client._streamingRecognize(') + s.replace(f'owl-bot-staging/{version}/src/{version}/{name}_client.ts', r'\Z', '\n' + "import {ImprovedStreamingClient} from '../helpers';\n" + '// eslint-disable-next-line @typescript-eslint/no-empty-interface\n' + 'export interface SpeechClient extends ImprovedStreamingClient {}\n' ) - -templates = common_templates.node_library(source_location='build/src') -s.copy(templates) - -node.postprocess_gapic_library() +node.owlbot_main(templates_excludes=["src/index.ts"], patch_staging=patch) diff --git a/packages/google-cloud-speech/samples/README.md b/packages/google-cloud-speech/samples/README.md index 26a8902f357..15eb0bc3ee4 100644 --- a/packages/google-cloud-speech/samples/README.md +++ b/packages/google-cloud-speech/samples/README.md @@ -15,6 +15,7 @@ * [Microphone stream](#microphone-stream) * [Beta Features](#beta-features) * [Infinite Streaming](#infinite-streaming) + * [Model Adaptation](#model-adaptation) * [Multi Region](#multi-region) * [Profanity Filter](#profanity-filter) * [Quickstart](#quickstart) @@ -92,6 +93,23 @@ __Usage:__ +### Model Adaptation + +View the [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/modelAdaptation.js). + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/modelAdaptation.js,samples/README.md) + +__Usage:__ + + +`node samples/modelAdaptation.js` + + +----- + + + + ### Multi Region View the [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/multiRegion.js).