使用脚本而不是麦克风向 google 助手发送命令
Sending commands to google assistant using script instead of mic
我已经在 Raspberry Pi 3 中配置了 Google Assistant SDK,演示应用程序运行良好。有什么方法可以使用 Python 脚本将“OK Google,示例命令”发送到 Google Assistant SDK?或者它只会接受来自 Mic 的输入?
我打算编写微型移动应用程序,它将向我的 Raspberry Pi google 助手应用程序发送命令。
当前版本的 Assistant SDK (Alpha v1) 仅支持发送和接收音频。然而,这是一个常见的请求,我们将在未来的更新中看到他们提供的内容。
UPDATE:即使是老问题,这里也是最新的更新。
现在可以使用 v1alpha2 版本。 gRPC 消息 AssistConfig
被定义为一个联合,您可以在其中选择 音频输出配置 或 文本查询 .
如果您正在使用 python 库,请参阅 AssistConfig
. Here is an example of config using a text query (adapted from the pushtotalk.py
sample, line 183):
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, here is the link to the godoc.
我已经在 Raspberry Pi 3 中配置了 Google Assistant SDK,演示应用程序运行良好。有什么方法可以使用 Python 脚本将“OK Google,示例命令”发送到 Google Assistant SDK?或者它只会接受来自 Mic 的输入?
我打算编写微型移动应用程序,它将向我的 Raspberry Pi google 助手应用程序发送命令。
当前版本的 Assistant SDK (Alpha v1) 仅支持发送和接收音频。然而,这是一个常见的请求,我们将在未来的更新中看到他们提供的内容。
UPDATE:即使是老问题,这里也是最新的更新。
现在可以使用 v1alpha2 版本。 gRPC 消息 AssistConfig
被定义为一个联合,您可以在其中选择 音频输出配置 或 文本查询 .
如果您正在使用 python 库,请参阅 AssistConfig
. Here is an example of config using a text query (adapted from the pushtotalk.py
sample, line 183):
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, here is the link to the godoc.