google-assistant-sdk/googlesamples/assistant/grpc/pushtotalk.py
def gen_assist_requests(self):
        """Yields: AssistRequest messages to send to the API."""

        config = embedded_assistant_pb2.AssistConfig(
            audio_in_config=embedded_assistant_pb2.AudioInConfig(
                encoding='LINEAR16',
                sample_rate_hertz=self.conversation_stream.sample_rate,
            ),
            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=embedded_assistant_pb2.DialogStateIn(
                language_code=self.language_code,
                conversation_state=self.conversation_state,
                is_new_conversation=self.is_new_conversation,
            ),
            device_config=embedded_assistant_pb2.DeviceConfig(
                device_id=self.device_id,
                device_model_id=self.device_model_id,
            ))
        if self.display:
            config.screen_out_config.screen_mode = PLAYING
        # Continue current conversation with later requests.
        self.is_new_conversation = False
        # The first AssistRequest must contain the AssistConfig
        # and no audio data.
        yield embedded_assistant_pb2.AssistRequest(config=config)
        for data in self.conversation_stream:
            # Subsequent requests need audio data, but not config.
            yield embedded_assistant_pb2.AssistRequest(audio_in=data)
Yields: AssistRequest messages to send to the API.
AssistRequest messages to send to the API.
AssistRequest messages to send to the API .
def gen_assist_requests(self):
        config = embedded_assistant_pb2.AssistConfig(
            audio_in_config=embedded_assistant_pb2.AudioInConfig(
                encoding='LINEAR16',
                sample_rate_hertz=self.conversation_stream.sample_rate,
            ),
            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=embedded_assistant_pb2.DialogStateIn(
                language_code=self.language_code,
                conversation_state=self.conversation_state,
                is_new_conversation=self.is_new_conversation,
            ),
            device_config=embedded_assistant_pb2.DeviceConfig(
                device_id=self.device_id,
                device_model_id=self.device_model_id,
            ))
        if self.display:
            config.screen_out_config.screen_mode = PLAYING
        self.is_new_conversation = False
        yield embedded_assistant_pb2.AssistRequest(config=config)
        for data in self.conversation_stream:
            yield embedded_assistant_pb2.AssistRequest(audio_in=data)
def gen_assist_requests ( self ) : config = embedded_assistant_pb2 . AssistConfig ( audio_in_config = embedded_assistant_pb2 . AudioInConfig ( encoding = 'LINEAR16' , sample_rate_hertz = self . conversation_stream . sample_rate , ) , 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 = embedded_assistant_pb2 . DialogStateIn ( language_code = self . language_code , conversation_state = self . conversation_state , is_new_conversation = self . is_new_conversation , ) , device_config = embedded_assistant_pb2 . DeviceConfig ( device_id = self . device_id , device_model_id = self . device_model_id , ) ) if self . display : config . screen_out_config . screen_mode = PLAYING self . is_new_conversation = False yield embedded_assistant_pb2 . AssistRequest ( config = config ) for data in self . conversation_stream : yield embedded_assistant_pb2 . AssistRequest ( audio_in = data )
Yields: AssistRequest messages to send to the API.
Yields : AssistRequest messages to send to the API .
"""Yields: AssistRequest messages to send to the API.""" # Continue current conversation with later requests. # The first AssistRequest must contain the AssistConfig # and no audio data. # Subsequent requests need audio data, but not config.
self