Skip to content

OHF-Voice/sentence-transformers-agent

Repository files navigation

Warning

This project is a prototype and is not production-ready.

Sentence Transformers Agent

A Wyoming protocol conversation agent for Home Assistant that uses a combination of hassil templates and sentence transformers to handle voice commands.

How it works

The agent receives the transcription (text) of a voice command, such as "what time is it?" or "turn on the lights." This text is matched against a set of potential commands, and if a command is matched its actions are executed.

To start, the voice command text is checked against a set of hassil templates. These templates are rigid, but designed to catch the most common commands quickly.

If the template match fails, a sentence transformers model is used to see how close the text is to a small set of example sentences for each command. This is a much less rigid match (fuzzy), and care must be taken to ensure non-sensical or ambiguous commands aren't accidentally matched!

For a successful match (rigid or fuzzy), two steps are taken. First, a series of "checks" are run to ensure the matched command's actions can be executed. These checks are Jinja2 templates that are rendered in Home Assistant, and may return necessary information for the actions (such as the area id to target). If any check produces an error or returns a "false" value, the actions will not be executed.

Assuming all checks are successful, the matched command's actions are executed. Both actions and the checks preceeding them have access to "slots" from the matching process. For templates, these are predefined {list} values whereas examples use extractors (currently just numbers and durations).

About

A conversation that has both strict and fuzzy matching

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors