Hassil - Home Assistant Intent Language Parser

raw JSON →
3.5.0 verified Fri May 01 auth: no python

A Python library to parse Home Assistant Intent Language (HassIL) sentence definitions. Version 3.5.0 is current; follows a rolling release cadence aligned with Home Assistant developments.

pip install hassil
error ModuleNotFoundError: No module named 'hassil'
cause Package not installed or environment issue.
fix
Run pip install hassil and ensure you are using Python >=3.9.
error AttributeError: module 'hassil' has no attribute 'parse_sentence'
cause Import path changed; parse_sentence is top-level but not in older versions.
fix
Upgrade to hassil >=1.0 and use from hassil import parse_sentence.
error ValueError: No parser available for language '...'
cause Unsupported or missing language definition in YAML.
fix
Make sure the language field in YAML is a valid code (e.g., 'en', 'de', 'fr') and that the intents are defined with that language.
breaking In version 3.0, the `parse_sentence` function signature changed: the `slots` parameter is now optional and the return type changed from a tuple to an `IntentMatch` object.
fix Update code to expect `result.intent.name` instead of `intent_name` from tuple unpacking.
deprecated The `from hassil import Sentence` class is deprecated in favor of using `Intents.from_yaml` directly.
fix Replace `Sentence` with `Intents` and use `Intents.from_yaml()`.
gotcha Slot lists expect a list of `TextSlotList` or `ListSlotSchema` objects, not plain dicts. Passing raw YAML dicts will raise a validation error.
fix Use the provided schema classes: `from hassil.slot_schemas import TextSlotList` and construct properly.

Parses a sentence against YAML-defined intents and prints the matched intent name.

from hassil import parse_sentence, Intents, SlotSchema

intents_yaml = """
language: "en"
intents:
  Greet:
    data:
      - sentences:
          - "hello"
"""

intents = Intents.from_yaml(intents_yaml)
slots = []  # optional slot schemas
result = parse_sentence("hello", intents, slots)
if result:
    print(f"Intent: {result.intent.name}")
else:
    print("No match")