Skip to content

C++ Google Assistant stack using CMake and PortAudio. Builds for Linux, Mac, Windows, and Android.

License

Notifications You must be signed in to change notification settings

jwinarske/assistant-sdk-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC C++ samples for Google Assistant SDK

Requirements

This project is officially supported on Ubuntu 14.04. Other Linux distributions may be able to run this sample.

Refer to the Assistant SDK documentation for more information.

Setup instructions

Clean Project

If you have not setup this project before, you can skip this step.

sudo apt-get purge libc-ares-dev  # https://github.com/grpc/grpc/pull/10706#issuecomment-302775038
sudo apt-get purge libprotobuf-dev libprotoc-dev
sudo rm -rf /usr/local/bin/grpc_* /usr/local/bin/protoc \
    /usr/local/include/google/protobuf/ /usr/local/include/grpc/ /usr/local/include/grpc++/ \
    /usr/local/lib/libproto* /usr/local/lib/libgpr* /usr/local/lib/libgrpc* \
    /usr/local/lib/pkgconfig/protobuf* /usr/local/lib/pkgconfig/grpc* \
    /usr/local/share/grpc/

Build Project

  1. Clone this project
git clone https://github.com/googlesamples/assistant-sdk-cpp.git
cd assistant-sdk-cpp
export PROJECT_PATH=$(pwd)
  1. Install dependencies
sudo apt-get install autoconf automake libtool build-essential curl unzip
sudo apt-get install libasound2-dev  # For ALSA sound output
sudo apt-get install libcurl4-openssl-dev # CURL development library
  1. Build Protocol Buffer, gRPC, and Google APIs
git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
GRPC_PATH=${PROJECT_PATH}/grpc
cd ${GRPC_PATH}

git submodule update --init

cd third_party/protobuf
./autogen.sh && ./configure && make
sudo make install
sudo ldconfig

export LDFLAGS="$LDFLAGS -lm"
cd ${GRPC_PATH}
make clean
make
sudo make install
sudo ldconfig

cd ${PROJECT_PATH}
git clone https://github.com/googleapis/googleapis.git
cd googleapis/
make LANGUAGE=cpp
  1. Make sure you setup environment variable $GOOGLEAPIS_GENS_PATH
export GOOGLEAPIS_GENS_PATH=${PROJECT_PATH}/googleapis/gens
  1. Build this project
cd ${PROJECT_PATH}
make run_assistant
  1. Get credentials file. It must be an end-user's credentials.
  • Go to the Actions Console and register your device model, following these instructions
  • Move it in this folder and rename it to client_secret.json
  • run get_credentials.sh in this folder. It will create the file credentials.json.
  1. Start run_assistant
./run_assistant --audio_input ./resources/weather_in_mountain_view.raw --credentials_file ./credentials.json --credentials_type USER_ACCOUNT

On a Linux workstation, you can alternatively use ALSA for audio input:

./run_assistant --audio_input ALSA_INPUT --credentials_file ./credentials.json --credentials_type USER_ACCOUNT

You can use a text-based query instead of audio:

./run_assistant --text_input "What time is it?" --credentials_file ./credentials.json --credentials_type USER_ACCOUNT

To change the locale, include a locale parameter:

./run_assistant --text_input "Bonjour" --credentials_file ./credentials.json --credentials_type USER_ACCOUNT --locale "fr-FR"

Default Assistant gRPC API endpoint is embeddedassistant.googleapis.com. If you want to test with a custom Assistant gRPC API endpoint, you can pass an extra "--api_endpoint CUSTOM_API_ENDPOINT" to run_assistant.

About

C++ Google Assistant stack using CMake and PortAudio. Builds for Linux, Mac, Windows, and Android.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages

  • C++ 61.4%
  • CMake 21.0%
  • Shell 9.0%
  • Makefile 7.5%
  • C 1.1%