Asynchronous speech recognition starts a long running audio processing operation. Use asynchronous speech recognition to recognize audio that is longer than a minute. For shorter audio, Synchronous Speech Recognition is faster and simpler.You can retrieve the results of the operation via the google.longrunning.Operations interface. Results remain available for retrieval for 5 days (120 hours). Audio content can be sent directly to Cloud Speech-to-Text or it can process audio content that already resides in Google Cloud Storage. See also the audio limits for asynchronous speech recognition requests.
This resource represents a long-running operation that is the result of a network API call.
done - boolean
If the value isfalse
, it means the operation is still in progress. Iftrue
, the operation is completed, and eithererror
orresponse
is available.Union fieldresult
. The operation result, which can be either anerror
or a validresponse
. Ifdone
==false
, neithererror
norresponse
is set. Ifdone
==true
, exactly one oferror
orresponse
is set.result
can be only one of the following:
await
it seems like there isn't a way to get response before the result is ready. Which would not work in a cloud function.responses
example, from second then
.I've shorten the data in Buffer attributes for brevity.initialApiResponse
exampleoperations.get
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
operationName
is the name
that you get in initialApiResponse
. while firebaseApiKey
you can find it in google cloud console. You do not need this API key if calling this end point within a firebase function.name
is a string and is The name of the operation resource.
name
attribute of the initialApiResponse
it would be possible to do pooling and gets the latest state of a long-running operation. Including result when it's done. via the operations.get
.