Google 云文本转语音请求的最大大小

Maximum size of Google Cloud Text-to-Speech requests

当我为太长的文本提交综合请求时,出现以下错误:

google.api_core.exceptions.ResourceExhausted: 429 Received message larger than max (X vs. 4194304)

其中 "X" 是返回请求的字节大小。为什么请求限制为 4MB?我知道 requests are limited to 5000 characters,但我的请求是 ~1500 个字符,远未达到限制。是否可以接收大于 4MB 的消息?还是 5000 个字符的限制不是 Google 文字转语音的真正瓶颈?

如果它改变了什么,我正在使用不同的 en-us Wavenet 语音和 LINEAR16 编码。

这是一个对我有用的程序性修复程序 (Python)(如 GitHub post: https://github.com/googleapis/python-texttospeech/issues/5#issuecomment-709562585 中所提议)

from google.cloud import texttospeech_v1
from google.cloud.texttospeech_v1.services.text_to_speech.transports.grpc import (
    TextToSpeechGrpcTransport,
)

channel = TextToSpeechGrpcTransport.create_channel(
    options=[("grpc.max_receive_message_length", 24 * 1024 * 1024)]
)
transport = TextToSpeechGrpcTransport(channel=channel)
client = texttospeech_v1.TextToSpeechClient(transport=transport)