diff --git a/blog/2023-02-03-responses.md b/blog/2023-02-03-responses.md new file mode 100644 index 00000000..f8853ce4 --- /dev/null +++ b/blog/2023-02-03-responses.md @@ -0,0 +1,37 @@ +--- +author: Michael Hansen +authorURL: https://twitter.com/rhasspy +authorImageURL: /img/profile/mike_hansen.png +authorTwitter: rhasspy +title: Intent Responses and Whitespace +--- + +The [intents repository](https://github.com/home-assistant/intents/) which powers [Assist](https://www.home-assistant.io/docs/assist), has had two important changes. + +First, data blocks in the intents YAML can now have a `response` key. For example: + +```yaml +language: en +intents: + HassTurnOn: + data: + - sentences: + - "open {name}" + response: cover +``` + +A response with a matching key must be defined in `responses//.yaml`: + +```yaml +language: en +responses: + intents: + HassTurnOn: + cover: "Opened {{ slots.name }}" +``` + +Response templates are in the [Jinja2 format](https://www.home-assistant.io/docs/configuration/templating/), and may access the matched intent's `slots` as well as the `state` of the affected entity. + +The second change comes from [hassil](https://github.com/home-assistant/hassil), the parser for our [intent template syntax](/docs/voice/intent-recognition/template-sentence-syntax/). In addition to an 8-10x speed-up in parsing, whitespace inside templates is taken literally. + +Previously, a template like `light(s | ing)` would match both "light" and "lighting". Now, "light" and "light ing" would be matched instead due to the extra space around `|`. The correct template would be `light(s|ing)` diff --git a/static/img/profile/mike_hansen.png b/static/img/profile/mike_hansen.png new file mode 100755 index 00000000..d8f8551b Binary files /dev/null and b/static/img/profile/mike_hansen.png differ