- Issue created by @itamair
- 🇬🇧United Kingdom MrDaleSmith
Can you provide the settings you put on the field for the automator? We'll need to see what the AI was being asked to do to properly recreate the issue.
- 🇮🇹Italy itamair
Here it is ... @mrdalesmith
uuid: f0db98a4-198c-463c-ad89-4156ade5cf36 langcode: en status: true dependencies: config: - field.field.node.geo_image.field_geoplace_type id: node.geo_image.field_geoplace_type.default label: 'Geoplace Type Default' rule: llm_entity_reference input_mode: token weight: 100 worker_type: direct entity_type: node bundle: geo_image field_name: field_geoplace_type edit_mode: true base_field: revision_log prompt: '' token: 'Select a Value based on the [node:field_geo_image_media:entity:field_media_image] of the Geo Image Media field for this content' plugin_config: automator_enabled: 1 automator_rule: llm_entity_reference automator_entity_reference_bundle: geoplaces_types automator_entity_field_enable_tid: 0 automator_entity_field_generate_tid: '' automator_entity_field_enable_revision_id: 0 automator_entity_field_generate_revision_id: '' automator_entity_field_enable_revision_log_message: 0 automator_entity_field_generate_revision_log_message: '' automator_entity_field_enable_name: 1 automator_entity_field_generate_name: 'Select a Value based on the [node:field_geo_image_media:entity:field_media_image] of the Geo Image Media field for this content' automator_entity_field_enable_description: 0 automator_entity_field_generate_description: '' automator_entity_field_enable_weight: 0 automator_entity_field_generate_weight: '' automator_entity_field_enable_publish_state: 0 automator_entity_field_generate_publish_state: '' automator_entity_field_enable_unpublish_state: 0 automator_entity_field_generate_unpublish_state: '' automator_mode: token automator_base_field: revision_log automator_prompt: '' automator_token: 'Select a Value based on the [node:field_geo_image_media:entity:field_media_image] of the Geo Image Media field for this content' automator_edit_mode: 1 automator_label: 'Geoplace Type Default' automator_weight: '100' automator_worker_type: direct automator_ai_provider: default_json
- 🇬🇧United Kingdom MrDaleSmith
OK there's a couple of things wrong with your field configuration that explains why it wasn't working:
1. You should use the LLM: Taxonomy Reference AI Automator Type to populate a taxonomy term, rather than the generic LLM Entity Reference one.
2. Your Automator Base Field is currently the Revision Log message - presumably this is where you're getting the error if the automator is trying to extract the value of this field and it hasn't been set when you save your node. The Automator Base Field should be the field that contains the context you want to send to the LLM.
3. The LLM: Taxonomy Reference and LLM: Entity Reference automator types don't support sending an image as context to the AI - that requires using a different type of AI to analyse it and currently the automators for most fields only support using the "chat" operation type. Because of that, what you're trying to do won't currently be possible.
4. The prompt you are using is using Drupal tokens to embed the value of the field: the Automator Prompts don't currently decode Drupal tokens so the image won't get sent to the AI this way either.
5. Your prompt doesn't include the {{ context }} placeholder, so the base field you have selected won't get sent to the AI either.You might need to read through the instructions for the automators to help you configure them correctly - https://project.pages.drupalcode.org/ai/modules/ai_automators/
However, I'd agree that the automator should handle misconfiguration of this kind in a more graceful manner, so I'll leave this issue open so we can prevent the fatal error.
- Merge request !458Ensure variable is set before counting it. #3504568 → (Open) created by MrDaleSmith
- 🇮🇹Italy itamair
Thanks al lot @mrdalesmith ... amazing explanation and support!
I will read properly all the documentation.Hope you will make this error breaking everything more silently ..
- 🇮🇹Italy itamair
@ I QA and Tested the MR!458 state, but it just forward another error further in the ai_automator code workflow.
It looks that I am not permitted to push commits into it,
thus I describe my contribution / solution ...
https://git.drupalcode.org/project/ai/-/merge_requests/458#note_458716That further change (that I suggest) solves this isse to me.
- 🇬🇧United Kingdom MrDaleSmith
If you have changes to push you need to click the green "get push access" button above and make sure you've followed the instructions at https://www.drupal.org/docs/develop/git/using-gitlab-to-contribute-to-dr... → for whichever method you want to use to contribute.
- 🇮🇹Italy itamair
Ah damn! Right you are ... I simply forgot about that "get push access" button.
So I did and pushed my further commit.
As said, in this state MR!458 fixes this issue and use case of mine ... - 🇬🇧United Kingdom MrDaleSmith
I'm going to knock this back to needs review so someone can test it who didn't do the code changes.