Hi,
I am trying to get my shopping list content to and to give the content to my LLM, I was trying to grab the result from a script into my intent_script.
Script get_shopping_list_content
:
sequence:
- alias: Grab the content of the shopping list.
target:
entity_id: todo.shopping_list
data:
status: needs_action
response_variable: shopping_list_data
action: todo.get_items
- alias: Format Shopping List Response
variables:
message: >
{% if shopping_list_data and shopping_list_data['todo.shopping_list']
and shopping_list_data['todo.shopping_list']['items'] | length > 0 %}
{% set x = shopping_list_data['todo.shopping_list']['items'] | map(attribute='summary') | list %}
{{ ' and '.join((x | join(', ')).rsplit(', ', 1)) }}
{% else %}
Your list is empty
{% endif %}
- stop: ""
response_variable: message
Intent_script:
ShoppingListContent:
description: "Pede os conteúdos da lista de compras e devolve uma lista de todos os elementos presentes na lista das compras."
action:
- service: script.get_shopping_list_content
response_variable: message
- stop: ""
response_variable: message
speech:
text: |
{% if action_response %}
{{ action_response|tojson }}
{% else %}
The shopping list is not available.
{% endif %}
My LLM is always replying with The shopping list is not available.
Is this even possible to do at the moment, if yes what am I doing wrong?
For note, I can grab the content if my intent_script is the following:
ShoppingListContent:
description: "Pede os conteúdos da lista de compras e devolve uma lista de todos os elementos presentes na lista das compras."
action:
- alias: Obtém o conteúdo da Lista de Compras.
service: todo.get_items
target:
entity_id: todo.shopping_list
data:
status: needs_action
response_variable: shopping_list_data
- alias: Format Shopping List Response
variables:
message: >
{% if shopping_list_data and shopping_list_data['todo.shopping_list'] and shopping_list_data['todo.shopping_list']['items'] | length > 0 %}
{% set x = shopping_list_data['todo.shopping_list']['items'] | map(attribute='summary') | list %}
{{ ' e '.join((x | join(', ')).rsplit(', ', 1)) }}
{% else %}
A sua Lista de Compras está vazia.
{% endif %}
- stop: ""
response_variable: message
speech:
text: |
{% if action_response %}
{{ action_response|tojson }}
{% else %}
Não consegui obter a lista de compras.
{% endif %}