Google comes with Google Assistant to rival Amazon’s Alexa smart home assistant. Primarily available with limited functionality in Google Allo app, the intelligent personal assistant developed by Google later rolled out with Google Home and Pixel smartphones to bring its full potential to consumers. Afterward, mobiles running Android 6.0+ also received Google Assistant and recently the search engine launched the Google Assistant SDK, making it able to run on almost any platform. You can now get Google Assistant on Windows, Mac, and Linux operating systems. Here’s how.
Get Google Assistant on Windows, Mac, or Linux OS
In order to get Google Assistant on Windows, Mac, or Linux platform, you’ll need to have Python installed on your system. The installation process is quite simple and already well-documented by Python wiki, so we’re not going into nifty details about getting Python up and running on your system.
Once you’ve got Python on your system, you can verify if it is working by opening up a terminal or command prompt and then typing ‘Python’. If the command prompt or terminal returns the current version of Python on your system, then you’re ready to move on the next step to continue.
Now, you need to enable access to Google Assistant API in the Google Cloud Platform Console before installing the necessary files to get the assistant working. Here’s how to get Google Assistant on Windows or any other platform using Python program:
Read more at 5 new Google voice features you really need to know
Configure Google Assistant API
Here’re the steps to enable Google Assistant API in the Cloud Platform Console. All the steps are platform-independent, meaning that the steps will remain the same for Windows, Mac, and GNU/Linux users.
- Navigate to the Projects Page in the Cloud Platform Console
- Click on the Create Project button at the top
- Name the project “My Google Assistant” and click on the Create button
- You’ll see a spinning progress icon in the top-right corner, meaning that the Console takes a few seconds to create your new project. Once it has created your project, you’ll be brought to your Project’s configuration page
- Navigate to the Google Assistant API page and click on the Enable button at the top
- You’ll receive a warning, asking you that you need to create credentials to use this API. Simply click on the blue Create Credentials button. This will take you to a setup wizard page where Google helps you figure out what kind of credentials you need to set Google Assistant
- Under the ‘where will you be calling the API from’ section, select the Other UI (e.g. Windows, CLI tool) option. Select the User data circle for the section that reads ‘what data will you be accessing’. Now, click on the ‘what credentials do I need?’ option
- Google should recommend that you create an OAuth 2.0 client ID. Name the Client ID as per your need and click on the Create Client ID button
- Under the ‘Product name shown to users’ section, enter ‘My Google Assistant’ and click on the Continue button
- Click on the Done button. There’s no need to click on the Download Here option as we only need the client secret, which we’ll download the next
- Afterward, under the OAuth 2.0 client IDs’ list, you should see the Client ID you just made. All you need to do is just click on the Download icon to grab the client_secret_XXX.json file, where XXX represents your client ID. Save this file on your system carefully
- Navigate to the Activity Controls Page for your Google account and ensure that the ‘Web & App Activity’, ‘Location History’, ‘Device Information’, and ‘Voice & Audio Activity’ are turned on, so that Google Assistant can actually read your personalized information
So you’ve created a mechanism for a client to access the Goggle Assistant API under your Google account. Next, you need to set up the client that will access the Google Assistant API. Here’s how to do so:
Install the Google Assistant Sample Python Project
Launch the terminal or command prompt window and follow the steps below:
- First of all, enter the command below
py -m pip install google-assistant-sdk[samples]
Once you’ve entered the command, you’ll see a whole bunch of dependencies being downloaded and installed. The dependencies are required for the sample Python project to work. Wait for a few seconds to finish it
- Next, enter the following command
py –m googlesamples.assistant.auth_helpers –client-secrets path\to\your\client_secret_XXX.apps.googleusercontent.com.json
- In the command prompt, you’ll see a response telling you to visit a URL to authorize the application
- Just copy and paste this URL into your browser. Select the same Google account that you used to configure the Google Assistant API. On the resulting page, you’ll see a text box, containing your client’s Access Token
- Copy and paste the Access Token into the command prompt where it asks you for the authorization code. Once it is done, you’ll receive a feedback that your credentials have been saved
Test the Google Assistant
Once you get Google Assistant on your Windows, Mac, or Linux system, the first thing you’ll want to test is whether the assistant can record audios from your microphone or not. Open command prompt and type the command below, which will record an audio of 5 seconds time duration and play it back to you:
python -m googlesamples.assistant.audio_helpers
In case you hear the audio played back to you, enter the following command to begin talking to Google Assistant:
python -m googlesamples.assistant
Wait for a few seconds to let command prompt say ‘Press Enter to send a new request’. Once it is done, press the Enter key to start talking to Google Assistant. After you’re done speaking, the command prompt will show a transcript of what you just stated and then play back the response.
Now you know how to set Google Assistant on Windows, Mac, or Linux system. So have fun playing with the personal assistant developed by Google!