AI Agents reinvent Drupal

Created on 21 November 2024, about 1 month ago

Problem/Motivation

The AI Assistants are config entities that provide some default configuration is none have been set and allow the user to add tokens into their prompts to pull in data from the entities. But the code rolls its own methods for both these pieces of functionality, ignoring the well established methods of tokenising entity field values and providiong default configuration that exist in Drupal Core.

Proposed resolution

Replace the current custom methods of setting default config and token support on the AI module with proper defauilt config and Token module implementations.

📌 Task
Status

Active

Version

1.0

Component

AI Assistants API

Created by

🇬🇧United Kingdom MrDaleSmith

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @MrDaleSmith
  • 🇩🇪Germany marcus_johansson

    If this is connected to AI Assistants API, this would be great for sure - if the tokens exists that we need.

    We have discussed further down the line to use twig, so we can use conditionals and iterations, so for instance you might want to have a prompt block that is {% if user_logged_in %){% endif %}.

    If that is possible as research before choosing to use token, from security persepective and how well we can make the validations and UI around it, it would be good to have some thoughts about that first. Otherwise the token solution is better than the current PoC stuff.

  • 🇬🇧United Kingdom MrDaleSmith

    Sorery: yes, Assistants not Agents.

    Token support is well established and works using Drupal's current permission system: you would add token support for the config entity and your tokens would then be available. Token support exists in Twig as well so I don't see that being a major issue, and it would open up the number of supported to tokens a user could use to include the global tokens as well.

    Not sure what you want from validations and security given that the current system doesn't validate anything around a use of [pre_prompt] or [system_role].

  • 🇩🇪Germany marcus_johansson

    Security and validation was more if we were using twig to render the prompt to validate correct twig syntax, but if we can use tokens in twig you are right that the permissions are already solved. I was thinking of something like if you have field permissions, so you don't expose the value of that field in the prompt for a user that does not have access to it.

    So this is great, feel free to refactor it.

  • Merge request !287Add token support → (Open) created by MrDaleSmith
  • Pipeline finished with Failed
    about 1 month ago
    Total: 248s
    #346078
  • Pipeline finished with Failed
    about 1 month ago
    Total: 189s
    #346107
  • Pipeline finished with Success
    about 1 month ago
    Total: 157s
    #346118
  • Pipeline finished with Failed
    about 1 month ago
    Total: 154s
    #346759
  • Pipeline finished with Failed
    about 1 month ago
    Total: 179s
    #346840
  • Pipeline finished with Failed
    25 days ago
    Total: 176s
    #351966
  • Pipeline finished with Failed
    25 days ago
    Total: 172s
    #351978
  • Pipeline finished with Success
    25 days ago
    Total: 214s
    #351989
  • 🇬🇧United Kingdom MrDaleSmith

    Re-upping as merge conflicts resolved.

Production build 0.71.5 2024