[Tracker]
Update Summary: [One-line status update for stakeholders]
Short Description: Replace the custom provider/model selectors in the AI Validations FieldValidationRule plugins with the Provider Configuration Form Element, with default models enabled.
Check-in Date: MM/DD/YYYY
[/Tracker]

Problem/Motivation

The AI Validations module currently rolls its own provider/model selection UI in each FieldValidationRule plugin that doesn't allow for default model, making recipes hard. The AI module now ships a reusable Provider Configuration Form Element that handles this consistently, including default model selection. See AI Provider Configuration Form Element.

Proposed resolution

  • Switch AiTextConstraintFieldValidationRule to the Provider Configuration Form Element.
  • Switch AiImageConstraintFieldValidationRule to the Provider Configuration Form Element.
  • Switch AiImageClassificationConstraintFieldValidationRule to the Provider Configuration Form Element.
  • Enable default models on the element so each rule falls back to the site's configured default.

AI usage (if applicable)

[x] AI Assisted Issue
This issue was generated with AI assistance, but was reviewed and refined by the creator.

[ ] AI Assisted Code
[ ] AI Generated Code
[ ] Vibe Coded

- This issue was created with the help of AI

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

marcus_johansson created an issue. See original summary.

ahmad-khalil-imagex’s picture

Assigned: Unassigned » ahmad-khalil-imagex

ahmad-khalil-imagex’s picture

Assigned: ahmad-khalil-imagex » Unassigned
Status: Active » Needs review
marcus_johansson’s picture

Assigned: Unassigned » marcus_johansson

Reviewing

marcus_johansson’s picture

Assigned: marcus_johansson » Unassigned
Status: Needs review » Needs work

Some feedback there. One of them you can skip if you feel like it, the other ones should be done if I didn't missunderstand something.

I also wonder if we should set these rules to final, so we can be pretty lenient with changing them in the future. Less of an issue though.

ahmad-khalil-imagex’s picture

Assigned: Unassigned » ahmad-khalil-imagex
ahmad-khalil-imagex’s picture

Assigned: ahmad-khalil-imagex » Unassigned
Status: Needs work » Needs review

Refactored code as suggested.

marcus_johansson’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests, +AI Initiative Sprint, +AI Product Development

The code looks great, except for the cspell error. Setting back to needs work because of it, see: https://git.drupalcode.org/issue/ai_validations-3586397/-/jobs/9594252

I've set to needs testing before this can be merged - one example of how it can be tested is documented here: https://project.pages.drupalcode.org/ai/1.3.x/contribute/testing/full_pa...

An options is to write functional javascript tests.

ahmad-khalil-imagex’s picture

Status: Needs work » Needs review

Fixed cspell error.