How to get Google Assistant on your Windows, Mac, or Linux
Google Assistant is Google’s resolution to Amazon’s Alexa smart home assistant. Initially only available with restricted functionality in the Google Allo application, Google Assistant later rolled out with the Google Home and Pixel smartphones to convey the overall power of Google’s assistant to customers.
After a couple of months of waiting, smartphones running Android 6.0+ also received Google Assistant, and only some days in the past Google introduced the Google Assistant SDK which permits Assistant to be run on principally any platform. Lately, we can display you the best way to set up Google Assistant onto your Windows, Mac, or Linux gadget using Python.
Get Google Assistant on your Windows/Mac/Linux Machines
You’ll need to have Python installed regardless of whether or not or no longer you might be the use of Windows, macOS, or a GNU/Linux distribution. Installation is reasonably easy and already well-documented by the Python wiki, so we won’t pass into many information about getting Python up and running for your system.
Once you’ve got Python operating for your device (you’ll be able to verify it’s working via opening up a terminal/command recommended and then simply typing
python.) If you see the terminal/command recommended return the current Python model for your laptop, then you’re golden.
Subsequent, sooner than we will be able to set up the essential recordsdata to get Google Assistant operating, we wish to permit get admission to the Google Assistant API in the Google Cloud Platform Console.
Configure the Google Assistant API
What follows are step by step directions strolling you in the course of the procedure to permit the Google Assistant API within the Cloud Platform Console so you’ll be able to get admission to Google Assistant in the course of the Python program. All of those steps are platform unbiased, that means that the stairs are the similar for Home windows, macOS, and GNU/Linux customers.
- Go to the Projects page within the Google Cloud Platform Console.
- Click on “Create Project” up best.
- Identify the Project “My Google Assistant” and click on “Create.”
- Wait a couple of seconds for the Console to create your new Project. You should see a spinning progress icon within the top right. After it’s done creating your Project, you’ll be introduced in your Project’s configuration web page.
- Click this link to go immediately to the Google Assistant API web page. Up top, click on “Permit.”
- Google will alert you that you need to create credentials to make use of this API. Click on “Create credentials” within the top right. This may increasingly take you to a setup wizard web page where Google helps you determine what sort of credentials you wish to have to make use of this API.
- Beneath “where will you be calling the API from”, make a selection “Other UI (e.g. Windows, CLI tool)“. For “what data will you be getting access to” make a selection the “User data” circle. Now tap “what credentials do I need?”
- Google will have to suggest that you just create an OAuth 2.0 client ID. Identify the Consumer ID anything you want, for instance, your title + Desktop. As soon as performed choosing a reputation, click on “create client ID.”
- Beneath “product name shown to users” enter “My Google Assistant.” Click on proceed.
- Click on “done.” There’s no wish to click on download right here as we only want the client secret, which we can download next.
- Now below the checklist of OAuth 2.0 client IDs, you should see the client ID you simply made. The entire technique to the right, click on at the download icon to download the client_secret_XXX.json file, where ‘XXX’ is your client ID. Save this document anyplace for your laptop, preferably in a new folder referred to as “googleassistant.”
- Go to the Activity controls page on your Google account and be sure that “Web & App Activity”, “Location History”, “Device Data”, and “Voice & Audio Activity” are enabled. That is so Google Assistant can actually learn you personalised information.
We have now created a mechanism for a shopper, in this case our Windows/Mac/Linux system, to access the Google Assistant API below our Google account. Next we wish to arrange the client that may access the Google Assistant API.
Get Google Assistant Sample Python Project
Open up a terminal/command prompt window and go through the following steps. First, enter this command:
py -m pip set up google-assistant-sdk[samples]
You will have to see a complete bunch of dependencies being downloaded and installed while you input this command. Those are needed for the pattern Python project to work. Watch for it to complete.
As soon as it’s done, subsequent input the next command (be sure to alter the path):
py -m googlesamples.assistant.auth_helpers --client-secrets pathtoyourclient_secret_XXX.apps.googleusercontent.com.json
Within the command recommended, you’ll see a reaction telling you to visit a URL with a purpose to authorize the applying.
Copy and paste this URL into your browser. Select the same Google account that you just used to configure the Google Assistant API. At the subsequent web page, you’ll see a textual content field that accommodates your client’s Access Token.
Copy that Access token and paste it into the command prompt where it asks you for the authorization code. If done correctly, you’ll see a response that your credentials have been stored.
Check the Google Assistant
The very first thing you’ll need to take a look at is whether or not or not Google Assistant is in a position to record audio out of your microphone. Input the following command right into a command prompt, which is able to document five seconds of audio and play it back to you:
python -m googlesamples.assistant.audio_helpers
For those who hear your audio performed back to you, then enter this command to start speaking to Google Assistant:
python -m googlesamples.assistant
Watch for the command prompt to say “press Enter to send a new request”, then press Enter to begin speaking to Google Assistant. After you’re done talking, the command prompt will show a transcript of what you simply said and then play back the response. For those who see a caution afterwards, simply ignore it.
Have a laugh playing with Google Assistant for your Windows, macOS, or GNU/Linux system! I performed with it for just a few mins before getting bored with it. It’s no longer in particular helpful on this layout, however it is a very fast demonstration of the possibilities that the new Google Assistant SDK represents. Perhaps we might see desktop apps or browser extensions taking advantage of this functionality within the near future.