androidthings / sample-googleassistant

Google Assistant API sample for Android Things
Apache License 2.0
467 stars 147 forks source link

Ability to pass text inputs to the google assistant #31

Closed akashbangad closed 6 years ago

akashbangad commented 7 years ago

Please add the ability to send in text request to the google assistant api

Ranjith1992 commented 7 years ago

I also need the same.

akashbangad commented 7 years ago

@Ranjith1992 I think so one way of doing this would be using the text to speech class to convert the text into audio file and sending it over to google assistant api

Ranjith1992 commented 7 years ago

But it time consuming.It will effect the performance of application.

akashbangad commented 7 years ago

Sure it would effect the performance of your application, I am suggesting the work around in case you absolutely need the solution right now. For a more performance oriented solution you have to wait for google to open up the api for text request to the assistant sdk.

Another approach would be completely take of your google assistant client from your app side and integrate it in your back-end. There is a nice node library available for the same here is the link https://www.npmjs.com/package/google-assistant-node

So you can create an api which would take in the text input then you can do the text to speech conversion and passing it on to google assistant api on your backend and provide the response.

This would also not be a performance optimal solution but I think it might be a bit better than to do handle the same on client side.

proppy commented 7 years ago

@AkashBang @Ranjith1992

As @Fleker pointed in https://github.com/androidthings/sample-googleassistant/issues/30#issuecomment-320115148, text input and output are not currently supported by the API.

I encourage you to discuss this feature request with the team the http://g.co/assistantsdkdev community.

navasmdc commented 6 years ago

In the last version of the API(v1 alpha 2), there is a property, text_query, in AssistConfig to sent a query if there isn't an audio in device, however, in the java versión this property doesn't appear, Which is the reason?

https://developers.google.com/assistant/sdk/reference/rpc/google.assistant.embedded.v1alpha2#assistconfig

proppy commented 6 years ago

@navasmdc It should be available since https://github.com/androidthings/sample-googleassistant/commit/004b0f8e2920b120d9a0eb2d7d3e33e85e94f1dd

navasmdc commented 6 years ago

Hi @proppy sorry, but I don't see the property within the code, Where is it? And if this property was within the code, this issue would be closed? Because you could send text input by string

proppy commented 6 years ago

@navasmdc you're right, it seems that the version in https://github.com/androidthings/sample-googleassistant/commit/004b0f8e2920b120d9a0eb2d7d3e33e85e94f1dd doesn't correspond to the public version hosted in: https://github.com/googleapis/googleapis/blob/master/google/assistant/embedded/v1alpha2/embedded_assistant.proto#L85

A workaround for now could be to manually by copying the embedded_assistant.proto file into /grpc/src/main/proto/google/assistant/embedded/v1alpha2.

Fleker commented 6 years ago

Yeah there's a commit that adds that field to the proto that hasn't been pushed yet.

Fleker commented 6 years ago

We added text input to the Assistant in 1b1c266fdd9972b0e582f66de99eab6f050b3d18.