UPDATE:即使这是一个老问题,这是最新的更新。
现在可以使用v1alpha2版本。 gRPC 消息AssistConfig
被定义为一个联合,您可以在其中选择音频输出配置 or a 文本查询.
如果您正在使用python图书馆,请参阅AssistConfig https://developers.google.com/assistant/sdk/reference/rpc/google.assistant.embedded.v1alpha2#assistconfig。这是使用文本查询的配置示例(改编自pushtotalk.py示例,第 183 行 https://github.com/googlesamples/assistant-sdk-python/blob/master/google-assistant-sdk/googlesamples/assistant/grpc/pushtotalk.py):
config = embedded_assistant_pb2.AssistConfig(
# instead of audio_in_config
# note: no need to use 'OK google'
text_query = "who are you ?",
audio_out_config=embedded_assistant_pb2.AudioOutConfig(
encoding='LINEAR16',
sample_rate_hertz=self.conversation_stream.sample_rate,
volume_percentage=self.conversation_stream.volume_percentage,
),
dialog_state_in=dialog_state_in,
device_config=embedded_assistant_pb2.DeviceConfig(
device_id=self.device_id,
device_model_id=self.device_model_id,
)
)
如果您正在使用golang, 这是 godoc 的链接 https://godoc.org/google.golang.org/genproto/googleapis/assistant/embedded/v1alpha2#AssistConfig.