Class SpeechTranslationServiceClient (0.2.0)

SpeechTranslationServiceClient(*, credentials: google.auth.credentials.Credentials = None, transport: 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'> = None)

Provides translation from/to media types.

Methods

SpeechTranslationServiceClient

SpeechTranslationServiceClient(*, credentials: google.auth.credentials.Credentials = None, transport: 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'> = 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. (1) The api_endpoint property can be used to override the default endpoint provided by the client. (2) If transport argument is None, client_options can be used to create a mutual TLS transport. If client_cert_source is provided, mutual TLS transport will be created with the given api_endpoint or the default mTLS endpoint, and the client SSL credentials obtained from client_cert_source.

Exceptions
TypeDescription
google.auth.exceptions.MutualTlsChannelErrorIf mutual TLS transport creation failed for any reason.

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.