Skip to main content

This package contains a collection of samples and tools to help you get started with the Google Assistant SDK using Python.

Installing

  • You can install using pip:

    pip install --upgrade google-assistant-sdk[samples]

Usage

google-oauthlib-tool

This tool creates test credentials to authorize devices to call the Google Assistant Service when prototyping.

googlesamples-assistant-audiotest

This tool verifies device setup for audio recording and playback.

  • Install the sample’s dependencies:

    sudo apt-get install portaudio19-dev libffi-dev libssl-dev
    pip install --upgrade google-assistant-sdk[samples]
  • Record 10 seconds of audio samples and play them back:

    googlesamples-assistant-audiotest --record-time 10
  • Adjust the sound device block size and flush size for a soundcard with limited throughput:

    googlesamples-assistant-audiotest --record-time 10 --audio-block-size=3200 --audio-flush-size=6400

The same --audio-block-size and --audio-flush-size options can be used on the gRPC samples included in the SDK.

googlesamples-assistant-devicetool

This tool allows you to register Google Assistant device models and instances and associate them with Device Actions traits.

  • Install the sample’s dependencies:

    sudo apt-get install portaudio19-dev libffi-dev libssl-dev
    pip install --upgrade google-assistant-sdk[samples]
  • Show the CLI tool usage:

    googlesamples-assistant-devicetool --help
  • Register a new device model and new device instance (after replacing the ‘placeholder values’ between quotes):

    googlesamples-assistant-devicetool --project-id PROJECT_ID register --model 'my-model-identifier' \
                                                                        --type LIGHT --trait action.devices.traits.OnOff \
                                                                        --manufacturer 'Assistant SDK developer' \
                                                                        --product-name 'Assistant SDK light' \
                                                                        --description 'Assistant SDK light device' \
                                                                        --device 'my-device-identifier' \
                                                                        --nickname 'My Assistant Light'
  • Register or overwrite the device model with the supported traits (after replacing the ‘placeholder values’ between quotes):

    googlesamples-assistant-devicetool --project-id PROJECT_ID register-model --model 'my-model-identifier' \
                                                                              --type LIGHT --trait action.devices.traits.OnOff \
                                                                              --manufacturer 'Assistant SDK developer' \
                                                                              --product-name 'Assistant SDK light' \
                                                                              --description 'Assistant SDK light device'

Note: The model identifier must be globally unique.

  • Register or overwrite the device instance using the device model (after replacing the ‘placeholder values’ between quotes):

    googlesamples-assistant-devicetool --project-id PROJECT_ID register-device --device 'my-device-identifier' \
                                                                               --model 'my-model-identifier' \
                                                                               --nickname 'My Assistant Light'

Note: The device instance identifier should be unique within the Google Developer Project associated with the device.

  • Verify that the device model and instance have been registered correctly:

    googlesamples-assistant-devicetool --project-id PROJECT_ID get --model 'my-model-identifier'
    googlesamples-assistant-devicetool --project-id PROJECT_ID get --device 'my-device-identifier'
  • List all device models and instances:

    googlesamples-assistant-devicetool --project-id PROJECT_ID list --model
    googlesamples-assistant-devicetool --project-id PROJECT_ID list --device

googlesamples-assistant-pushtotalk

This reference sample implements a simple but functional client for the Google Assistant Service.

  • Install the sample’s dependencies:

    sudo apt-get install portaudio19-dev libffi-dev libssl-dev
    pip install --upgrade google-assistant-sdk[samples]
  • Run the push to talk sample. The sample records a voice query after a key press and plays back the Google Assistant’s answer:

    googlesamples-assistant-pushtotalk --device-model-id 'my-device-model' --device-id 'my-device-identifier'
  • Try some Google Assistant voice query like “What time is it?” or “Who am I?”.

  • Try a device action query like “Turn <nickname / model product name> on”.

  • Run in verbose mode to see the gRPC communication with the Google Assistant Service:

    googlesamples-assistant-pushtotalk --device-model-id 'my-device-model' --device-id 'my-device-identifier' -v

Also see the grpc sample README.

For Maintainers

See MAINTAINER.md for more documentation on the development, maintainance and release of the Python package itself.

Contributing

Contributions to this repository are always welcome and highly encouraged.

See CONTRIBUTING.md for more information on how to get started.

License

Copyright (C) 2017 Google Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Metadata

Release files for google-assistant-sdk 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for google-assistant-sdk 0.6.0
File Size Uploaded
google-assistant-sdk-0.6.0.tar.gz 140.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for google-assistant-sdk 0.6.0
File Interpreter ABI Platform
google_assistant_sdk-0.6.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 171.5 kB

Release files / google-assistant-sdk-0.6.0.tar.gz

Download URL google-assistant-sdk-0.6.0.tar.gz
Size 140.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e2bfa45ed61a50f92395d47f463b7f11abedb15bd38d04dbf3a633f97e6ccb6b
BLAKE2b-256 checksum
How to use checksums
56fa38342b570c51d55702067c1247e149665533f8f78c87c30c5740778df9c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.5.2

Release files / google_assistant_sdk-0.6.0-py2.py3-none-any.whl

Download URL google_assistant_sdk-0.6.0-py2.py3-none-any.whl
Size 31.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
54afd833400a5abf710eb422b8580d7c27cad883aa16c009973af62b3ccd7d74
BLAKE2b-256 checksum
How to use checksums
dbf6d1c2e940e8e2f3045aa9cca50db736fb376dc9aa83c950e72c388d3df16b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.5.2

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page