Class SpeechTranslationServiceClient (0.1.1)

SpeechTranslationServiceClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Optional[Union[str, google.cloud.mediatranslation_v1beta1.services.speech_translation_service.transports.base.SpeechTranslationServiceTransport]] = None, client_options: <module 'google.api_core.client_options' from '/workspace/python-media-translation/.nox/docfx/lib/python3.9/site-packages/google/api_core/client_options.py'> = ClientOptions: {'api_endpoint': 'mediatranslation.googleapis.com', 'client_cert_source': None, 'client_encrypted_cert_source': None, 'quota_project_id': None, 'credentials_file': None, 'scopes': None, 'api_key': None, 'api_audience': None})

Provides translation from/to media types.

Methods

SpeechTranslationServiceClient

SpeechTranslationServiceClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Optional[Union[str, google.cloud.mediatranslation_v1beta1.services.speech_translation_service.transports.base.SpeechTranslationServiceTransport]] = None, client_options: <module 'google.api_core.client_options' from '/workspace/python-media-translation/.nox/docfx/lib/python3.9/site-packages/google/api_core/client_options.py'> = ClientOptions: {'api_endpoint': 'mediatranslation.googleapis.com', 'client_cert_source': None, 'client_encrypted_cert_source': None, 'quota_project_id': None, 'credentials_file': None, 'scopes': None, 'api_key': None, 'api_audience': None})

Instantiate the speech translation service client.

Parameters
NameDescription
credentials Optional[google.auth.credentials.Credentials]

The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.

transport Union[str, .SpeechTranslationServiceTransport]

The transport to use. If set to None, a transport is chosen automatically.

client_options ClientOptions

Custom options for the client.

from_service_account_file

from_service_account_file(filename: str, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
{@api.name}The constructed client.

from_service_account_json

from_service_account_json(filename: str, *args, **kwargs)

Creates an instance of this client using the provided credentials file.

Parameter
NameDescription
filename str

The path to the service account private key json file.

Returns
TypeDescription
{@api.name}The constructed client.

streaming_translate_speech

streaming_translate_speech(requests: Optional[Iterator[google.cloud.mediatranslation_v1beta1.types.media_translation.StreamingTranslateSpeechRequest]] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())

Performs bidirectional streaming speech translation: receive results while sending audio. This method is only available via the gRPC API (not REST).

Parameters
NameDescription
requests Iterator[.media_translation.StreamingTranslateSpeechRequest]

The request object iterator. The top-level message sent by the client for the StreamingTranslateSpeech method. Multiple StreamingTranslateSpeechRequest messages are sent. The first message must contain a streaming_config message and must not contain audio_content data. All subsequent messages must contain audio_content data and must not contain a streaming_config message.

retry google.api_core.retry.Retry

Designation of what errors, if any, should be retried.

timeout float

The timeout for this request.

metadata Sequence[Tuple[str, str]]

Strings which should be sent along with the request as metadata.

Returns
TypeDescription
Iterable[.media_translation.StreamingTranslateSpeechResponse]A streaming speech translation response corresponding to a portion of the audio currently processed.