airflow.providers.google.cloud.hooks.speech_to_text
¶
此模組包含 Google Cloud Speech Hook。
模組內容¶
類別¶
Google Cloud Speech API 的 Hook。 |
- class airflow.providers.google.cloud.hooks.speech_to_text.CloudSpeechToTextHook(gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[原始碼]¶
基底:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook
Google Cloud Speech API 的 Hook。
- 參數
gcp_conn_id (str) – 提取連線資訊時使用的連線 ID。
impersonation_chain (str | collections.abc.Sequence[str] | None) – 可選的服務帳戶,用於使用短期憑證模擬身分,或用於取得列表中最後一個帳戶的 access_token 所需的帳戶鏈結列表,該帳戶將在請求中被模擬身分。如果設定為字串,則該帳戶必須授予原始帳戶「服務帳戶權杖建立者」IAM 角色。如果設定為序列,則列表中的身分必須授予緊鄰前一個身分「服務帳戶權杖建立者」IAM 角色,列表中的第一個帳戶將此角色授予原始帳戶。
- get_conn()[原始碼]¶
檢索到 Cloud Speech 的連線。
- 返回
Google Cloud Speech 用戶端物件。
- 返回類型
google.cloud.speech_v1.SpeechClient
- recognize_speech(config, audio, retry=DEFAULT, timeout=None)[原始碼]¶
辨識音訊輸入。
- 參數
config (dict | google.cloud.speech_v1.types.RecognitionConfig) – 向辨識器提供的資訊,用於指定如何處理請求。 https://googleapis.github.io/google-cloud-python/latest/speech/gapic/v1/types.html#google.cloud.speech_v1.types.RecognitionConfig
audio (dict | google.cloud.speech_v1.types.RecognitionAudio) – 要辨識的音訊資料 https://googleapis.github.io/google-cloud-python/latest/speech/gapic/v1/types.html#google.cloud.speech_v1.types.RecognitionAudio
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – (可選) 用於重試請求的重試物件。如果指定 None,則不會重試請求。
timeout (float | None) – (可選) 等待請求完成的時間量 (以秒為單位)。請注意,如果指定了重試,則逾時適用於每次個別嘗試。