Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow sentence metadata in responses #2108

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

synesthesiam
Copy link
Contributor

Sentence metadata was added to hassil in version 1.6.0:

language: en
intents:
  TestIntent:
    data:
      - sentences:
        - "..."
        metadata:
          key: value
        response: test_response

This PR exposes that metadata to response rendering as a metadata object:

language: en
responses:
  intents:
    TestIntent:
      test_response: "{{ metadata.key }}" 

This allows sentence authors to pass language-specific data to response templates, such as the non-inflected/base forms of nouns that are part of the matched sentence (device class, etc.).

@synesthesiam
Copy link
Contributor Author

synesthesiam commented Mar 27, 2024

@witold-gren Can you try this out and let me know if it works for you? I still need to modify Home Assistant core for this to work in Assist, but I want to make sure it's correct here first.

@witold-gren
Copy link
Contributor

I can confirm that now it works properly on intents scripts (this repository). Thanks for this improvement @synesthesiam

Copy link
Contributor

@tetele tetele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appologies for the delay. Simple, but very useful contribution, this <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants