Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

provide event driven interface on top of google-assistant-grpc #358

Open
@proppy

Description

@proppy

As shown by the our documentation https://developers.google.com/assistant/sdk/guides/service/integrate#implement_a_basic_conversation_dialog_with_the_assistant and the rather complicated https://github.com/googlesamples/assistant-sdk-python/blob/84995692f35be8e085de8dfa7032039a13ae3fab/google-assistant-sdk/googlesamples/assistant/grpc/pushtotalk.py example, creating a functional assistant on top of the generated gRPC bindings is not trivial, it currently requires developer to:

  • construct and authorize a bi-directional gRPC client
  • capture audio input samples and generate an asynchronous stream of AssistRequest message
  • handle END_OF_CONVERSATION event to stop audio capture
  • handle an asynchronous stream of AssistResponse message and playback incoming assistant audio samples
  • maintain conversation state

Simpler example like https://github.com/googlesamples/assistant-sdk-python/blob/84995692f35be8e085de8dfa7032039a13ae3fab/google-assistant-sdk/googlesamples/assistant/grpc/audiofileinput.py do a better job at showing low-level gRPC integration into a Python application, but they only handle a simpler conversation turn.

As suggested in #356, developer could benefit from a event based interface on on top of google-assistant-grpc, such wrapper should:

  • initialize and maintain the gRPC connection
  • surface high level conversation event similar to the google-assistant-library
  • maintain the conversation state
  • manage audio stream for recording and playback

One (pythonic) way to implement an event interface could be to do similar to the google-assistant-library, where event are surfaced using python generator, for example:

from google.assistant.sdk import assistant
for event in assistant.assist():
    print(event)

That would have the added value of providing some level of familiarity to former users of the google-assistant-library

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions