Skip to main content
Assume you are to build a voice assistant for your home. At the simplest level we would like the assistant to control functionality of each appliance in each room. The assistant would have to answer two things about every command: which room does the speaker mean, and what should happen there? Tazo can answer both straight from the audio, with no transcript. We will also see that Tazo can correctly identify a variety of targets, such as a specific room, any two rooms such as Bedroom & Kitchen, the room a user currently is in, and the whole house. In this cookbook we will build a small home assistant. It uses the Tazo Python SDK and a home with three rooms, each with one light: Bedroom, Kitchen and Study. Each command is two questions: Tazo answers one choice question per request, so each question is its own call on the same audio. The two calls run in parallel. The model never switches anything: the app does, and only when every answer reaches the confidence threshold.

Setup

Each command is a WAV recording of at most 30 seconds.

Model the home

The home is a dictionary of lights. Tazo sees its current state, plus who is speaking and which room they are in, as the state of each request. The speaker’s room matters for one thing only: resolving “here” or “this room”.

Define the questions

The target question has one option per room, one per pair of rooms, and three escape hatches: whole_home, unspecified and unknown_target. Whole-home is an option so that “turn off all the lights” is recognized and then deliberately not acted on. The action question is the same idea for the operation. Both also get a NO_TOOL option for audio with no usable request.
A request’s text (state, instructions and option descriptions) has a budget of about 1,000 characters. That is why the descriptions above are so short. If you add rooms, the number of two-room options grows quickly, so consider dropping them and handling one room per command.

Ask Tazo

One helper sends the audio with one question and returns the typed answer.

Decide what to do

This is the safety gate. A light changes only if the target is a real room (or pair of rooms) with at least 80% confidence and the action is on or off with at least 80% confidence. Anything else, including whole-home, becomes a clarifying question for the speaker.

Run it

Say “lights on here” while standing in the kitchen, then “turn off the study light”.
How the gate behaves on different commands:

Build on it

  • Keep the context fresh. Send the real device states and the speaker’s real room on every command. “Here” is only as good as the room you pass in.
  • Add more questions. You can extend the app to more appliances and more specific things such as setting the thermostat to a particular temperature. Additional information would create another call to Tazo.
  • Tune the threshold. 0.8 is a cautious default for actions that change the physical world. Lower it for harmless actions, raise it for risky ones.

Limitations

  • Whole-home commands always ask for clarification on purpose.

Bonus - Command to set the thermostat to a temperature

A setting command has a value, so it needs a third question. Tazo answers choice questions, so give it one option per temperature. Add a set_temperature action to the existing action question, and ask the temperature question only when that action wins:
Then call it from handle_command, right after the two answers arrive and before decide, while the client is still open:
“Set the thermostat to 22 degrees” now returns thermostat -> 22 °C. To set the thermostat in a particular room, combine the temperature with the target question you already ask. If each room has its own thermostat, the target answer already tells you which room or rooms the speaker means, including “here”. Ask the temperature question in parallel with the target and action questions, and when the action is set_temperature, apply the temperature to the rooms from decide. The same confidence gate applies: if the target is unspecified or unsure, ask “Which room do you mean?” instead of changing a thermostat.