Skip to content

Instantly share code, notes, and snippets.

@tronikos
Last active June 19, 2024 19:36
Show Gist options
  • Save tronikos/d10b7bd04bd37cb839543470c5266e58 to your computer and use it in GitHub Desktop.
Save tronikos/d10b7bd04bd37cb839543470c5266e58 to your computer and use it in GitHub Desktop.
intent_script examples for LLMs
# Copy paste this into configuration.yaml
# Adjust the entities for your calendar, TODO, and weather.
# Adjust the send notification intent names, descriptions, and the notify.mobile_app_x service calls.
# Restart HA.
#
# Then you can say:
# "you can chain tool calls, send tomorrow's calendar events after summarizing them to Marisol" (this will call CalendarGetEvents followed by SendNotificationMarisol)
# "what's in my todo list" "send them to Nikos"
# "who created Home Assistant" "send your response to Nikos"
# "send a message to Nikos: hi there"
# "what's in my calendar for today"
# "what's in my calendar for tomorrow"
# "what's in my todo list" BTW, with the built in intents you can add items to a list, e.g. "add buy milk to my personal tasks"
#
#
# The sentences here are only used by the built in Home Assistant agent. They are not used or seen by LLMs.
conversation:
intents:
WeatherGetForecastHourly:
- "Get hourly weather forecast"
WeatherGetForecastDaily:
- "Get daily weather forecast"
TodoGetItems:
- "Get items in my TODO"
CalendarGetEvents:
- "Get events in my calendar"
SendNotificationNikos:
- "Send notification to Nikos"
SendNotificationMarisol:
- "Send notification to Marisol"
# LLMs see the intent name, e.g. SendNotificationNikos and its description, e.g. "Sends a notification message to Nikos. Args: msg",
# which helps them know which intent to call and how to pass any args.
intent_script:
WeatherGetForecastHourly:
description: "Gets weather forecast for current day or hourly based"
action:
- service: weather.get_forecasts
target:
entity_id:
- weather.forecast_home
data:
type: hourly
response_variable: result
- stop: ""
response_variable: result
speech:
text: "{{ action_response }}"
WeatherGetForecastDaily:
description: "Gets weather forecast for next days"
action:
- service: weather.get_forecasts
target:
entity_id:
- weather.forecast_home
data:
type: daily
response_variable: result
- stop: ""
response_variable: result
speech:
text: "{{ action_response }}"
TodoGetItems:
description: "Gets items in my TODO"
action:
- service: todo.get_items
target:
entity_id:
- todo.personal_tasks
- todo.work_tasks
response_variable: result
- stop: ""
response_variable: result
speech:
text: "{{ action_response }}"
CalendarGetEvents:
description: "Gets events in my calendar"
action:
- service: calendar.get_events
target:
entity_id:
- calendar.personal
- calendar.work
data_template:
start_date_time: "{{ today_at('00:00') }}"
duration: { "hours": 48 }
response_variable: result
- stop: ""
response_variable: result
speech:
text: "{{ action_response }}"
SendNotificationNikos:
description: "Sends a notification message to Nikos. Args: msg"
action:
- service: notify.mobile_app_nikos
data:
message: "{{ msg }}"
speech:
text: "Done"
SendNotificationMarisol:
description: "Sends a notification message to Marisol. Args: msg"
action:
- service: notify.mobile_app_marisol
data:
message: "{{ msg }}"
speech:
text: "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment