The request is basically to enable response variables from scripts to be accessible to LLM-based assist agents during live conversations. Currently, while LLM agents can trigger scripts, they cannot access the returned responses or variables from those scripts, which limits their ability to provide dynamic, data-driven responses within the conversation.
After doing some testing, I can’t get it to work. Others seem to be having a similar experience. I’m glad the discussion is open though, only a matter of time.
Thanks for the example. I am able to get your blueprint to work correctly, but I cannot get my use-case to work correctly. I can run the script myself directly and I see all the response expected in the trace results, but despite exposing this script to Assist, my LLM agents act as if they do not have access to this tool.
My script involves a two stop process.
Download latest radar imagery from NWS
Analyze the image using custom component LLM Vision
I simply want those responses available to my LLM conversation agents. For some reason, it acts like this script is not exposed.
mode: parallel
max_exceeded: silent
description: >-
Downloads latest radar imagery for weather condition analysis and predictive
forecasting and then analyzes the images using LLM Vision Analyzer, providing
written descriptions of the radar features being observed.
icon: mdi:robot-excited
fields:
vision_prompt:
selector:
text: null
name: vision_prompt
description: >-
The descriptive prompt sent to OpenAI along with the images for
processing.
default: >-
Attached you will see three image files. Each represents a different
perspective of the current weather radar and precipitation signature for
the North East US. Of particular interest is Central New Jersey. Please analyze each of the three images to craft a professional
sounding, upcoming precipitation summary. Can you tell me if we should expect any precipitation in
the near future? Do not describe each image, consider the images all
snapshots of current time using different tools. Some images are at
different zoom levels, some at different resolutions. These combined
perspectives should offer a clear picture of what is going on
precipitation wise in the North East US. Concisely summarize the weather
conditions we should be expecting, please. Definitions of images
referenced by filename – KDIX_loop.gif – The National Weather Service
animated gif of PHILADELPHIA, NJ (KDIX) Radar product. This is the most
zoomed in perspective we have of the focal area. inmasirPA_.gif –
AccuWeather North East US radar (precipitation) animated gif. This image
represents the mid-level zoom view, showing all of NJ, PA, NY, VA, DE, and
MD. us_ne_4regradar_plus_usen.jpg – This is the widest view of the region
and also a still image. This is to provide a broad perspective, to see
what's possibly on the way and out of view from the other perspectives.
required: true
sequence:
- parallel:
- action: downloader.download_file
metadata: {}
data:
overwrite: false
url: https://radar.weather.gov/ridge/standard/KDIX_loop.gif
subdir: /config/www/weather_radar/ai/
- action: downloader.download_file
metadata: {}
data:
overwrite: false
url: >-
https://sirocco.accuweather.com/nx_mosaic_640x480_public/sir/inmasirPA_.gif
subdir: /config/www/weather_radar/ai/
- action: downloader.download_file
metadata: {}
data:
overwrite: false
url: >-
https://s.w-x.co/staticmaps/us_ne_4regradar_plus_usen.jpg?width=1920&format=pjpg&quality=80
subdir: /config/www/weather_radar/ai/
enabled: true
- variables:
vision_prompt: "{{ vision_prompt }}"
alias: Define prompt variable for LLM Vision
- alias: LLM Vision Analyzer - Analyze current precipitaton radar for North East US
action: llmvision.image_analyzer
metadata: {}
data:
provider: 01J5NWAZ1SRHKT0SSMK9ZSEG5W
model: gpt-4o
include_filename: true
detail: high
max_tokens: 300
temperature: 0.6
message: "{{ vision_prompt }}"
image_file: |-
/config/www/weather_radar/ai/KDIX_loop.gif
/config/www/weather_radar/ai/inmasirPA_.gif
/config/www/weather_radar/ai/us_ne_4regradar_plus_usen.jpg
response_variable: current_radar_summary
alias: "Weather: Analyze Current Radar"
Could it be that your LLM action is started before the files are fully downloaded?
And you don’t have the stop action which creates the response variable for the script itself
Thanks for the reply! There are always files present in the directory with those names, new ones are overwritten so worst-case it would be interpetting outdated images. But no that’s not what’s happening, I can run the script manually and everything works as intended.
I did have it set up with the stop action originally but it didn’t change anything so I removed it. I put it back in just now, still with no change. It’s as if the script is not exposed; Assist does not even attempt to run the script.
mode: parallel
max_exceeded: silent
description: >-
Downloads latest radar imagery for weather condition analysis and predictive
forecasting and then analyzes the images using LLM Vision Analyzer, providing
written descriptions of the radar features being observed.
icon: mdi:robot-excited
fields:
vision_prompt:
selector:
text: null
name: vision_prompt
description: >-
The descriptive prompt sent to OpenAI along with the images for
processing.
default: >-
Attached you will see three image files. Each represents a different
perspective of the current weather radar and precipitation signature for
the North East US. Please analyze each of the three images to craft a professional
sounding, upcoming precipitation summary.
required: true
sequence:
- parallel:
- action: downloader.download_file
metadata: {}
data:
overwrite: true
url: https://radar.weather.gov/ridge/standard/KDIX_loop.gif
subdir: /config/www/weather_radar/ai/
- action: downloader.download_file
metadata: {}
data:
overwrite: true
url: >-
https://sirocco.accuweather.com/nx_mosaic_640x480_public/sir/inmasirPA_.gif
subdir: /config/www/weather_radar/ai/
- action: downloader.download_file
metadata: {}
data:
overwrite: true
url: >-
https://s.w-x.co/staticmaps/us_ne_4regradar_plus_usen.jpg?width=1920&format=pjpg&quality=80
subdir: /config/www/weather_radar/ai/
filename: us_ne_4regradar_plus_usen.jpg
enabled: true
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
- variables:
vision_prompt: "{{ vision_prompt }}"
alias: Define prompt variable for LLM Vision
- alias: LLM Vision Analyzer - Analyze current precipitaton radar for North East US
action: llmvision.image_analyzer
metadata: {}
data:
provider: [REDACTED]
model: gpt-4o
include_filename: true
detail: high
max_tokens: 300
temperature: 0.6
message: "{{ vision_prompt }}"
image_file: |-
/config/www/weather_radar/ai/KDIX_loop.gif
/config/www/weather_radar/ai/inmasirPA_.gif
/config/www/weather_radar/ai/us_ne_4regradar_plus_usen.jpg
response_variable: current_radar_summary
- variables:
response:
radar_analysis: |
{{ current_radar_summary }}
- stop: ""
response_variable: response
alias: "Weather: Analyze Current Radar"
current_radar_summary:
response_text: >-
Based on the analysis of the radar images, New Jersey, is currently experiencing precipitation.
The mid-level view from AccuWeather
shows widespread precipitation across New Jersey and surrounding states,
confirming that the rain is likely to continue in the short term.
[REDACTED]
I was wondering if maybe it had to do with this change?
Do you remember why exposed scripts without a schema wouldn’t get exposed as a tool? Seems like it can have unintended side effects
You can’t overwrite variables. This needs to be a different name. Not saying this is your issue, but automations do not allow you to overwrite variables in namespace.
Thanks for the tip @petro – I actually had already tweaked the script a bit which included this change. Now I have set few field options, with intent for the LLM to choose, coupled with a static prompt. Still, the script is not an availabile tool for conversation agents to use (despite being exposed). Here is the updated YAML. Again, manually running the script works fine.
mode: parallel
max_exceeded: silent
description: >-
Downloads latest radar imagery for weather condition analysis and predictive
forecasting and then analyzes the images using LLM Vision Analyzer, providing
written descriptions of the radar features being observed.
icon: mdi:robot-excited
fields:
vision_prompt_option:
selector:
select:
options:
- Is it precipitating right now?
- Will it rain or snow in the near future?
- Will it stop raining or snowing soon?
- When will it rain or snow?
multiple: false
name: vision_prompt
description: >-
The descriptive prompt sent to OpenAI along with the images for
processing.
required: true
sequence:
- parallel:
- action: downloader.download_file
metadata: {}
data:
overwrite: true
url: https://radar.weather.gov/ridge/standard/KDIX_loop.gif
subdir: /config/www/weather_radar/ai/
- action: downloader.download_file
metadata: {}
data:
overwrite: true
url: >-
https://sirocco.accuweather.com/nx_mosaic_640x480_public/sir/inmasirPA_.gif
subdir: /config/www/weather_radar/ai/
- action: downloader.download_file
metadata: {}
data:
overwrite: true
url: >-
https://s.w-x.co/staticmaps/us_ne_4regradar_plus_usen.jpg?width=1920&format=pjpg&quality=80
subdir: /config/www/weather_radar/ai/
filename: us_ne_4regradar_plus_usen.jpg
enabled: true
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 500
- variables:
vision_prompt: "{{ vision_prompt_option }}"
alias: Define prompt variable for LLM Vision
- alias: LLM Vision Analyzer - Analyze current precipitaton radar for North East US
action: llmvision.image_analyzer
metadata: {}
data:
provider: 01J5NWAZ1SRHKT0SSMK9ZSEG5W
model: gpt-4o
include_filename: true
detail: high
max_tokens: 300
temperature: 0.6
message: >
{{ vision_prompt }} Attached you will see three image files. Each
represents a different perspective of the current weather radar and
precipitation signature for the North East US. Please analyze each of the three
images to craft a professional sounding, upcoming precipitation summary.
Do not describe each image,
consider the images all snapshots of current time using different tools.
Some images are at different zoom levels, some at different resolutions.
These combined perspectives should offer a clear picture of what is
going on precipitation wise in the North East US. Concisely summarize
the weather conditions we should be expecting. Definitions of images
referenced by filename – KDIX_loop.gif – The National Weather Service
animated gif of PHILADELPHIA, NJ (KDIX) Radar product. This is the most
zoomed in perspective we have of the focal area. inmasirPA_.gif –
AccuWeather North East US radar (precipitation) animated gif. This image
represents the mid-level zoom view, showing all of NJ, PA, NY, VA, DE,
and MD. us_ne_4regradar_plus_usen.jpg – This is the widest view of the
region and also a still image. This is to provide a broad perspective,
to see what is possibly on the way and out of view from the other
perspectives.
image_file: |-
/config/www/weather_radar/ai/KDIX_loop.gif
/config/www/weather_radar/ai/inmasirPA_.gif
/config/www/weather_radar/ai/us_ne_4regradar_plus_usen.jpg
response_variable: current_radar_summary
- variables:
response:
radar_analysis: |
{{ current_radar_summary }}
- stop: ""
response_variable: response
alias: "Weather: Analyze Current Radar"
Got it working. Over several months I have been tweaking and renaming both this script alias / ID while wrestling to get this to work before it was properly supported.
On a hunch I decided to delete this script and rebuild it fresh. The YAML is identical… but a now in a new, freshly exposed script, it works splendidly.
This WTH can probably be closed since as @balloob mentioned, he read my mind and it’s already implemented