assistant-sdk-python icon indicating copy to clipboard operation
assistant-sdk-python copied to clipboard

debug_config availability in google-assistant-grpc python library

Open dmarvp opened this issue 7 years ago • 10 comments

I get this error when trying to use the debug_config property on AssistConfig.

  File "/opt/virtual-device/lib/google_assistant.py", line 80, in assist
    for resp in assist_responses_generator:
  File "/usr/lib64/python2.7/site-packages/grpc/_channel.py", line 348, in next
    return self._next()
  File "/usr/lib64/python2.7/site-packages/grpc/_channel.py", line 328, in _next
    raise self
_Rendezvous: <_Rendezvous of RPC that terminated with:
	status = StatusCode.UNKNOWN
	details = "Exception iterating requests!"
	debug_error_string = "None"
>

Here's the code where I try to set it up

from google.assistant.embedded.v1alpha2.embedded_assistant_pb2 import *
from google.assistant.embedded.v1alpha2.embedded_assistant_pb2_grpc import *

def assist_audio_requests_generator(self, message, language_code, voice_id,
                                        new_conversation):
        yield AssistRequest(
            config=AssistConfig(
                audio_in_config=AudioInConfig(
                    encoding='LINEAR16', sample_rate_hertz=16000),
                screen_out_config=ScreenOutConfig(
                    screen_mode='OFF'),  #or PLAYING
                device_config=DeviceConfig(
                    device_id=self.user.user_id,
                    device_model_id="my_device_model_id"), 
                audio_out_config=AudioOutConfig(
                    encoding='LINEAR16',
                    sample_rate_hertz=16000,
                ),
                dialog_state_in=DialogStateIn(
                    language_code=language_code,
                    is_new_conversation=new_conversation),
                debug_config=DebugConfig(
                    return_debug_info=True
                )
                ))

It works correctly if I remove the debug_config property. Is it not available in version 0.2.0 of the python library? I've tried both with that version as well as 0.2.1.dev1 without success. If so, is there a planned release of the python library coming soon?

dmarvp avatar Aug 24 '18 23:08 dmarvp

Yeah, it does seem like this flag is not in the current generated code, probably as it's from an older proto. It's really only useful in conjunction with Actions on Google, so it hasn't been a priority to include in Python.

Fleker avatar Aug 25 '18 02:08 Fleker

hey @Fleker thanks for the response!

I need this because I would like to get better-structured information coming from the cards, which I know are in that json. Is there a new version of the python library planned?

FYI I would like to access card information like you do here with your AssistResponse class and the cards object: https://github.com/actions-on-google/actions-on-google-testing-nodejs#possible-responses

I just realized you are a contributor in both repositories, so hopefully, you can help me out.

dmarvp avatar Aug 27 '18 15:08 dmarvp

Yeah it's just a matter of updating the Python bindings that are based on the gRPC protobuf. You can do it right now technically using a protobuf code gen, though to add it here it should also be fairly straightforward.

Fleker avatar Aug 28 '18 06:08 Fleker

@dmarvp actually we released a pre-version with that fields a few months ago: https://pypi.python.org/pypi/google-assistant-grpc/0.2.1.dev1

You should be able to install it with:

pip install --pre --upgrade google-assistant-grpc

Looking forward your feedback!

proppy avatar Aug 30 '18 09:08 proppy

hi @proppy I actually did install that version before opening the ticket. I tried again just now to be sure and, for both for python 2.7 and 3.6, I took a look at the "embedded_assistant_pb2.py" file. Sadly, the debug_info field is not in there.

dmarvp avatar Sep 05 '18 05:09 dmarvp

@dmarvp you're right!

This should be fixed with: https://github.com/googlesamples/assistant-sdk-python/pull/291

You can try it with:

pip install 'git+https://github.com/proppy/assistant-sdk-python.git@debug-info#egg=google-assistant-grpc&subdirectory=google-assistant-grpc'

See:

>>> import google.assistant.embedded.v1alpha2.embedded_assistant_pb2
>>> google.assistant.embedded.v1alpha2.embedded_assistant_pb2.AssistConfig().debug_config is None
False

proppy avatar Sep 05 '18 05:09 proppy

I'm getting the same here when attempting to pass debug_config in google assistant-grpc python library. any workarounds or updates for this please?

mahmeds7777 avatar Mar 19 '19 16:03 mahmeds7777

hi @proppy and @Fleker , the fix on #291 had been working for us since Sep 2018, however, the debug_info has stopped returning anything in the last few days. It comes empty now. I was wondering if there have been changes in the assistant services that are causing this? As you know, we work with companies that rely on google assistant for testing their own actions and this is affecting their existing tests.

dmarvp avatar Jan 30 '20 21:01 dmarvp

@dmarvp which version of the API are you using?

proppy avatar Jan 31 '20 05:01 proppy

hi @proppy, I'm using v1alpha2 with the library from your comment on September 5, 2018.

dmarvp avatar Jan 31 '20 13:01 dmarvp