Google Assistant Linux
Before you can get to running the Google Assistant service, you need to know a few things, and set up a few others:
You’ll need to have Python 3 installed on your system.
Setting Up the Google Assistant API
Before you can use Google Assistant on your Linux, you’ll have to configure the Google Assistant API.
Go to “Projects” in the Google Cloud Platform Console website, and click on “Create Project”
.Give your project an appropriate name. I used “My Google Assistant” as the name, but “Way Better than Siri” will work just as well. Then, click on “Create”
The Cloud Platform Console will take some time to set up your project, and you’ll be able to see a progress circle in the top right. Once done, you can click on the “bell icon”, and then on the notification regarding your project.
In the page that opens up, click on “API Manager”.
Go to “Library”, and then search for “Google Assistant”.
Click on the “Google Assistant API” that shows up in the results, and then click on Enable.
Google will tell you that you may need credentials to use the API. Simply click on “Create credentials“.
In the form that opens up, choose “Other UI (eg Windows, CLI)” under “Where will you be calling the API from?“, and select “User Data” in “What data will you be accessing?“. Then click on “What credentials do I need?“
Create a client ID. You can give it any name that you want. Once done, click on “Create client ID“.
In the next step, use the name of your project in the “Product name as shown to users“, and then click “Continue”.
You’ll get the option to download the credentials. Click on “Done”. We’ll download the credentials later.
Go to Activity Controls, and ensure that all the toggles are turned on. This is required for the Google Assistant to provide personalized responses
In the next screen, you’ll be able to see the client ID you created. Click on the download icon at the very right of the screen. This will download a JSON file to your computer. Save it somewhere you can easily get to. I saved it at “/Users/akshaygangwar/assistant/“
Install Google Assistant Sample Project
Launch the Terminal (Command Prompt on Windows), and type the following command:
SDK
~$
python3 -m pip install google-assistant-sdk[samples]
Library
~$ pip install --upgrade google-assistant-library
Once the command completes, type the following command:
~$ pip install --upgrade google-auth-oauthlib[tool]
~$ google-oauthlib-tool --client-secrets path/to/client_secret_XXXXX.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless
You will get a URL as the output in the Terminal. Navigate to this URL in your browser, copy and paste the confirmation code from the webpage into the Terminal, and press Enter.
Use Google Assistant
SDK
Test Google Assistant
To launch google assistant enter following command:
~$
python -m googlesamples.assistant.grpc.pushtotalk
Library
Last updated
Was this helpful?