Speech Operation#

Long running operation representation for Google Speech API

class google.cloud.speech.operation.Operation(client, name, complete=False, metadata=None, results=None)[source]#

Bases: google.cloud.operation.Operation

Representation of a Google API Long-Running Operation.

Parameters:
  • client (Client) – Instance of speech client.
  • name (int) – ID assigned to an operation.
  • complete (bool) – True if operation is complete, else False.
  • metadata (Metadata) – Instance of Metadata with operation information.
  • results (dict) – Dictionary with transcript and score of operation.
complete#

Completion state of the Operation.

Return type:bool
Returns:True if already completed, else false.
classmethod from_api_repr(client, response)[source]#

Factory: construct an instance from Google Speech API.

Parameters:
  • client (Client) – Instance of speech client.
  • response (dict) – Dictionary response from Google Speech Operations API.
Return type:

Operation

Returns:

Instance of ~google.cloud.speech.operations.Operation.

metadata#

Metadata of operation.

Return type:Metadata
Returns:Instance of Metadata.
poll()[source]#

Check if the operation has finished.

Return type:bool
Returns:A boolean indicating if the current operation has completed.
Raises:ValueError if the operation has already completed.
results#

Results dictionary with transcript information.

Return type:dict
Returns:Dictionary with transcript and confidence score.