我通过网络谷歌云控制台的前端创建了一个谷歌云语音v2识别器。 Recognizer 服务位于 europe-west4,因为我需要 chirp 模型。 当我尝试通过 Node.js 客户端库获取识别器时,问题就出现了。
client.getRecognizer({ name: `projects/${project}/locations/europe-west4/recognizers/my-first-chirp` })
错误是:
Google speech v2: 'Expected resource location to be global, but found europe-west4 in resource name.',
当我尝试在 europe-west4 创建不同的识别器时,我收到相同的错误,但是在“global”位置创建时没有问题。问题是“global”不支持我需要的模型和语言。
当我尝试使用 .getRecognizer
在“
global”中找到我的识别器时,我收到一条错误消息,指出没有这样的识别器(如预期,因为它不在全局中)。
我有办法将 google 的节点库与 europe-west4 一起使用吗?
创建客户端时需要在URL中设置区域:
对于 Javascript/Typescript:
this.client = new v2.SpeechClient({
apiEndpoint: `europe-west4-speech.googleapis.com`,
});
对于Python
client_options_var = client_options.ClientOptions(
api_endpoint="europe-west4-speech.googleapis.com"
)
client = SpeechClient(client_options=client_options_var)
当心“-语音”部分
region + "-speech.googleapis.com"