С помощью Google Assistant SDK он принимает и текстовые, или аудиоданные в качестве входных данных.
В настоящее время это то, что может быть показано в примере pushtotalk .
Вот несколько фрагментов кода, показывающих, как это делается в примере:
audio_source = audio_helpers.WaveSource(
open(input_audio_file, 'rb'),
sample_rate=audio_sample_rate,
sample_width=audio_sample_width
# ...
# Create conversation stream with the
# given audio source and sink.
conversation_stream = audio_helpers.ConversationStream(
source=audio_source,
sink=audio_sink,
iter_size=audio_iter_size,
sample_width=audio_sample_width,
)
# ...
with SampleAssistant(lang, device_model_id, device_id,
conversation_stream,
grpc_channel, grpc_deadline,
device_handler) as assistant:
# If file arguments are supplied:
# exit after the first turn of the conversation.
if input_audio_file or output_audio_file:
assistant.assist()
return