Skip to content

Add speech asynchronous recognize support.#2426

Merged
daspecster merged 4 commits intogoogleapis:masterfrom
daspecster:add-speech-async
Sep 28, 2016
Merged

Add speech asynchronous recognize support.#2426
daspecster merged 4 commits intogoogleapis:masterfrom
daspecster:add-speech-async

Conversation

@daspecster
Copy link
Copy Markdown
Contributor

Add support for Speech API long running operations.

@daspecster daspecster added the api: speech Issues related to the Speech-to-Text API. label Sep 26, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 26, 2016
config['profanityFilter'] = profanity_filter
if speech_context is not None:
config['speechContext'] = {'phrases': speech_context}
def _build_request_data(content, source_uri, encoding, sample_rate,

This comment was marked as spam.

This comment was marked as spam.

Copy link
Copy Markdown
Contributor

@dhermes dhermes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% but I think there is a utility in google.protobuf for parsing a JSON version of a protobuf message type (here it is Operation)

>>> operation.complete
True
>>> operation.results[0]['alternatives'][0]['transcript']
"how old is the Brooklyn Bridge"

This comment was marked as spam.

This comment was marked as spam.

... operation.poll() # API call
>>> operation.complete
True
>>> operation.results[0]['alternatives'][0]['transcript']

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

AMR_WB = 'AMR_WB'
"""AMR_WB encoding type."""
from google.cloud.speech.encoding import Encoding
from google.cloud.speech.operation import Operation

This comment was marked as spam.

This comment was marked as spam.

config['profanityFilter'] = profanity_filter
if speech_context is not None:
config['speechContext'] = {'phrases': speech_context}
def _build_request_data(content, source_uri, encoding, sample_rate,

This comment was marked as spam.

from google.cloud._helpers import _rfc3339_to_datetime


class Operation(object):

This comment was marked as spam.

This comment was marked as spam.

}
]
}
]

This comment was marked as spam.

]
}
]
}

This comment was marked as spam.

'startTime': '2016-09-22T17:52:25.536964Z',
'lastUpdateTime': '2016-09-22T17:52:27.802902Z'
},
'done': False

This comment was marked as spam.

'google.cloud.speech.v1beta1.AsyncRecognizeMetadata'),
'progressPercent': 27,
'startTime': '2016-09-22T17:52:25.536964Z',
'lastUpdateTime': '2016-09-22T17:52:27.802902Z'

This comment was marked as spam.

"""The version of the API, used in building the API call's URL."""

API_URL_TEMPLATE = '{api_base_url}/{api_version}/speech:{path}'
API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}'

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@daspecster
Copy link
Copy Markdown
Contributor Author

@dhermes was there supposed to be a link in here?

I'm not 100% but I think there is a utility in google.protobuf for parsing a JSON version of a protobuf message type (here it is Operation)

encoding,
self.SAMPLE_RATE)
self.assertIsInstance(operation, Operation)
self.assertFalse(operation.complete)

This comment was marked as spam.

This comment was marked as spam.

... operation.poll() # API call
>>> operation.complete
True
>>> operation.results[0]['alternatives'][0]['transcript']

This comment was marked as spam.

"""The version of the API, used in building the API call's URL."""

API_URL_TEMPLATE = '{api_base_url}/{api_version}/speech:{path}'
API_URL_TEMPLATE = '{api_base_url}/{api_version}/{path}'

This comment was marked as spam.

@daspecster
Copy link
Copy Markdown
Contributor Author

@tseaver I think I got all the things you mentioned. LMKWYT

self._requested = []

def api_request(self, method, path):
self._requested.append({'method': method, 'path': path})

This comment was marked as spam.

This comment was marked as spam.

@tseaver
Copy link
Copy Markdown
Contributor

tseaver commented Sep 28, 2016

@daspecster Should be OK to merge if you can tweak the assertions for the operations tests (see above).

@daspecster daspecster merged commit 5a0e492 into googleapis:master Sep 28, 2016
@daspecster daspecster deleted the add-speech-async branch September 28, 2016 15:43
atulep pushed a commit that referenced this pull request Apr 3, 2023
Add speech asynchronous recognize support.
atulep pushed a commit that referenced this pull request Apr 18, 2023
Add speech asynchronous recognize support.
parthea pushed a commit that referenced this pull request Oct 22, 2023
Add speech asynchronous recognize support.
parthea pushed a commit that referenced this pull request Apr 1, 2026
Thank you for opening a Pull Request! Before submitting your PR, there
are a few things you can do to make sure it goes smoothly:
- [ ] Make sure to open an issue as a
[bug/issue](https://github.com/googleapis/python-bigquery-dataframes/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕
parthea pushed a commit that referenced this pull request Apr 1, 2026
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.

Librarian Version: v0.7.0
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:e7cc6823efb073a8a26e7cefdd869f12ec228abfbd2a44aa9a7eacc284023677
<details><summary>bigframes: 2.35.0</summary>

##
[2.35.0](googleapis/python-bigquery-dataframes@v2.34.0...v2.35.0)
(2026-02-07)

### Features

* Add bigframes.pandas.col with basic operators (#2405)
([12741677](googleapis/python-bigquery-dataframes@12741677))

* remove redundant &#34;started.&#34; messages from progress output
(#2440)
([2017cc2f](googleapis/python-bigquery-dataframes@2017cc2f))

* add bigframe.bigquery.load_data function (#2426)
([4b0f13b2](googleapis/python-bigquery-dataframes@4b0f13b2))

* Disable progress bars in Anywidget mode (#2444)
([4e2689a1](googleapis/python-bigquery-dataframes@4e2689a1))

* add bigquery.ai.generate_text function (#2433)
([5bd0029a](googleapis/python-bigquery-dataframes@5bd0029a))

* Disable progress bars in Anywidget mode to reduce notebook clutter
(#2437)
([853240da](googleapis/python-bigquery-dataframes@853240da))

* Add a bigframes cell magic for ipython (#2395)
([e6de52de](googleapis/python-bigquery-dataframes@e6de52de))

* add `bigframes.bigquery.ai.generate_embedding` (#2343)
([e91536c8](googleapis/python-bigquery-dataframes@e91536c8))

### Bug Fixes

* always display the results in the `%%bqsql` cell magics output (#2439)
([2d973b54](googleapis/python-bigquery-dataframes@2d973b54))

* exlcude gcsfs 2026.2.0 (#2445)
([311de31e](googleapis/python-bigquery-dataframes@311de31e))

* suppress JSONDtypeWarning in Anywidget mode and clean up progress
output (#2441)
([e0d185ad](googleapis/python-bigquery-dataframes@e0d185ad))

### Documentation

* fix cast method shown on public docs (#2436)
([ad0f33c6](googleapis/python-bigquery-dataframes@ad0f33c6))

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: speech Issues related to the Speech-to-Text API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants