Skip to content

Regenerate speech API. Now it contains streamingRecognize method. - #1775

Merged
stephenplusplus merged 4 commits into
googleapis:masterfrom
jmuk:speech
Nov 14, 2016
Merged

stephenplusplus merged 4 commits into
googleapis:masterfrom
jmuk:speech

Conversation

@jmuk

@jmuk jmuk commented Nov 8, 2016

Copy link
Copy Markdown
Contributor

This does not change src/index.js yet.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 8, 2016
@stephenplusplus stephenplusplus added the api: speech Issues related to the Speech-to-Text API. label Nov 8, 2016
@stephenplusplus

Copy link
Copy Markdown
Contributor

I've tried to integrate this with src/index, and it seems to work, except for the response event. Does gax expose a way to get the API's raw response? Currently:

speech.createRecognizeStream({...})
  .on('response', function(response) {
    response === {
      "code": 200,
      "details": "",
      "metadata": {
        "_internal_repr": {
          "content-disposition": [
            "attachment"
          ]
        }
      },
      "message": "OK"
    }
  })
  .on('data', function() {...})

@stephenplusplus

Copy link
Copy Markdown
Contributor

@jmuk to clarify, this response is from the grpc stream event named metadata: https://github.com/GoogleCloudPlatform/google-cloud-node/blob/116436fa789d8b0f7fc5100b19b424e3ec63e6bf/packages/common/src/grpc-service.js#L355

We rename it to response as its more common for users familiar with the tradition HTTP request/response workflow, with the response event being standard with the Node.js native HTTP module: https://nodejs.org/api/http.html#http_event_response

@jmuk

jmuk commented Nov 8, 2016

Copy link
Copy Markdown
Contributor Author

I see. It seems gax loses metadata and status event which gRPC supplies. Filed as googleapis/gax-nodejs#67 and I'm on it.

@jmuk

jmuk commented Nov 8, 2016

Copy link
Copy Markdown
Contributor Author

Could it be status instead of metadata which we want for response?

@stephenplusplus

Copy link
Copy Markdown
Contributor

Maybe, what is the difference between the status and response objects?

@jmuk

jmuk commented Nov 8, 2016

Copy link
Copy Markdown
Contributor Author

metadata only contains the part of {metadata: {_internal_repr: { ... }}} while status provides what you wrote -- including code or something. And it seems status comes at the end of the stream while metadata comes earlier.

@stephenplusplus

Copy link
Copy Markdown
Contributor

@callmehiphop wdyt? I think you were more closely connected with our implementation.

@callmehiphop

callmehiphop commented Nov 8, 2016 •

Copy link
Copy Markdown
Contributor

I think something to note is that status and metadata occur at different times. Where metadata happens once the request starts, status doesn't happen until after all results have been processed.

For that reason alone, I think in the veneer layer we typically listen for metadata.

@jmuk

jmuk commented Nov 9, 2016

Copy link
Copy Markdown
Contributor Author

Ah, okay. So https://github.com/GoogleCloudPlatform/google-cloud-node/blob/116436fa789d8b0f7fc5100b19b424e3ec63e6bf/packages/common/src/grpc-service.js#L355 does take 'metadata' event, and create the response object with "code: 0" (i.e. succeeds). I'll do the same thing.

@jmuk

jmuk commented Nov 9, 2016

Copy link
Copy Markdown
Contributor Author

Now it's added.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Nov 9, 2016
@stephenplusplus

Copy link
Copy Markdown
Contributor

I added a commit to use the new streaming method from our API.

@callmehiphop could you take a look and push a commit that gets rid of anything we don't need, re: GrpcService?

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 0c79f2b on jmuk:speech into 116436f on GoogleCloudPlatform:master.

@stephenplusplus stephenplusplus added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Nov 9, 2016
@callmehiphop

Copy link
Copy Markdown
Contributor

@stephenplusplus I don't think you can cut out GrpcService unless GAX also supports LRO.

@stephenplusplus

Copy link
Copy Markdown
Contributor

Okay, thanks for taking a look.

miguelvelezsa pushed a commit that referenced this pull request Jul 23, 2025
sofisl pushed a commit that referenced this pull request Feb 24, 2026
* test: use fully qualified request type name in tests

PiperOrigin-RevId: 475685359

Source-Link: googleapis/googleapis@7a12973

Source-Link: googleapis/googleapis-gen@370c729
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzcwYzcyOWUyYmEwNjJhMTY3NDQ5YzI3ODgyYmE1ZjM3OWM1YzM0ZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix: longrunning protos are no longer needed for v1 and v1beta1 clients

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Alexander Fenster <[email protected]>
sofisl pushed a commit that referenced this pull request Feb 26, 2026
Where the STRUCT value is an array, always determine inner member value using field index.

STRUCT value is represented by var 'decoded'.

Refs: #1774
sofisl pushed a commit that referenced this pull request Mar 17, 2026
sofisl added a commit that referenced this pull request Mar 17, 2026
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.

5 participants