Google 嵌入式助手服务在包含时报错 text_config 丢失

Google embedded assistant service gives an error about text_config missing when it is included

我正在尝试使用嵌入式 Google 助手服务 (https://developers.google.com/assistant/sdk/reference/rpc/google.assistant.embedded.v1alpha2) to send some text queries from an app I'm writing in Rust. As there's no official client library and I haven't been able to get either of the GRPC libraries I've tried working, I'm POSTing an AssistRequest proto directly to https://embeddedassistant.googleapis.com/$rpc/google.assistant.embedded.v1alpha2.EmbeddedAssistant/Assist。获得适当的 OAuth 令牌并注册设备 ID,我发送这样的原型:

config {
  text_query: "what's the time"
  audio_out_config {
    encoding: MP3
    sample_rate_hertz: 16000
  }
  screen_out_config {
    screen_mode: PLAYING
  }
  dialog_state_in {
    language_code: "en-US"
  }
  device_config {
    device_id: "my_device_id"
    device_model_id: "<my model id>"
  }
}

(填写了有效的 device_id 和 device_model_id)。但是,我总是得到 400 的回报,错误是

"Invalid \'AssistConfig\': audio_in_config or text_query must be provided."

明明填写 text_query 时,为什么会出现此错误?如果我尝试设置 audio_in_config.

,我会得到同样的错误

回答我自己的问题,原来我需要将请求包装在 StreamBody proto 中,将序列化的 AssistRequest 放在 消息 字段。不过,这在我能看到的任何地方都没有记录!