Italy
Account created on 24 April 2007, over 18 years ago
#

Merge Requests

More

Recent comments

🇮🇹Italy lussoluca Italy

Fixed, thanks

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

lussoluca created an issue.

🇮🇹Italy lussoluca Italy

I would like to opt for these projects:

* https://www.drupal.org/project/webprofiler (issues are now on gitlab.com and not on drupal.org, I'll migrate them by myself)
* https://www.drupal.org/project/monolog

Thanks

🇮🇹Italy lussoluca Italy

LGTM

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

I've added messenger:failed:remove also

🇮🇹Italy lussoluca Italy

lussoluca created an issue.

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

Implementing the messenger:failed:retry command, I've found that the findAll method must use a query like the one in the get method, otherwise it will return messages that have been successfully retried.

🇮🇹Italy lussoluca Italy

I've tested the feature and it works as expected

🇮🇹Italy lussoluca Italy

Can you please try with the new 1.1.0 release ?

🇮🇹Italy lussoluca Italy

lussoluca created an issue.

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

First POC is ready to be reviewed.

  • This MR adds the guardrail and guardrail_set concepts
  • This MR adds guardrail support for agents
  • This project implements an initial set of guardrails (I've separated the code for guardrails to ease dependency management)
🇮🇹Italy lussoluca Italy

A new Plugin type named AiGuardrail is added to define guardrails implementation. A guardrail plugin should implement ConfigurableInterface and PluginFormInterface from Core (to make the plugin configurable by a form). A new interface is created to mark plugins that need access to the AiPluginManager service: NeedsAiPluginManagerInterface.
An

AiGuardrail

plugin must implement the processInput method that takes a ChatInput as input and returns a GuardrailResultInterface. The AI module provides some implementation for the

GuardrailResultInterface

:

  • PassResult: indicates the input can pass without changes
  • StopResult: indicates the input should not be processed further (and a standard message has to be sent to the user)
  • RewriteInputResult: indicates the input should be rewritten (maybe to remove some PII)
  • RewriteOutputResult: indicates the output should be rewritten (maybe to remove unwanted information from a LLM response)

A new configuration entity named ai_guardrail is added, including an ID, label, description, the AiGuardrail plugin to use, and the plugin settings.
An AiGuardrailForm class is provided to render an AiGuardrail plugin form and to save the results as an AiGuardrail entity.
A single guardrail is usually insufficient to protect a conversation between users and an LLM. We want some guardrails to run on the chat input and some others to run on the LLM response, before sending the text to the user. To represent this standard behaviour, a new ai_guardrail_set configuration entity is added, including an ID, label, description, a list of guardrails plugins that must be run before sending the prompt to an LLM (pre_generate_guardrails), and a list of guardrails plugins that must be run after a response from an LLM is received (post_generate_guardrails). An AiGuardrailSetForm class is provided to create and configure a guardrail set with a UI.
Guardrails checks run in an event subscriber, configured to listen to ai.pre_generate_response and ai.post_generate_response events.
An initial integration with the AI module is provided in the chat_generator AiApiExplorer plugin: a new select is added to the Advanced accordion that can be used to choose which ai_guardrail_set to use.

See the attached screen recording for a demo of the UI.

🇮🇹Italy lussoluca Italy

Since guardrails can appear in many places such as automators, agents, tools, content suggestions, CKEditor, etc. we need a list of configuration UIs where the functionality can be added. Best would be with screenshots as we might need UX work to create a pleasant configuration experience.

I agree with you, maybe we should open a separate issue for the UI part?

🇮🇹Italy lussoluca Italy

But please, please, leave the `name` element out of the config.yaml so you don't have the weird project name in there. It's far better IMO for it to take the name from the enclosing directory.

Latest config.yaml is correct, right?

🇮🇹Italy lussoluca Italy

Thanks, Christoph.
That MR is for the version without DDEV committed. Then there is this one for the version with DDEV committed.

Feel free to review it as well, if you have time.

🇮🇹Italy lussoluca Italy

lussoluca changed the visibility of the branch 3518963-meta-create-the to hidden.

🇮🇹Italy lussoluca Italy

lussoluca changed the visibility of the branch 3518963-meta-create-the to active.

🇮🇹Italy lussoluca Italy

Meanwhile, I came up with a possible solution.

See the readme here: https://git.drupalcode.org/project/sm/-/merge_requests/43/diffs#8ec9a00b...

It's a super draft implementation (poor naming, no docs, ...), just to see if this approach can fix your issue.

🇮🇹Italy lussoluca Italy

Sorry, I wanted to push an initial stub, but then I realized that this issue was opened into ai_agents module (I worked on the ai module...)

I think that guardrails are a generic concept that can be applied to every interaction with an LLM, not only when using agents. Maybe we should move this issue to the ai project?

🇮🇹Italy lussoluca Italy

lussoluca changed the visibility of the branch 3518963-meta-create-the to hidden.

🇮🇹Italy lussoluca Italy

lussoluca changed the visibility of the branch 3518963-meta-create-the to active.

🇮🇹Italy lussoluca Italy

lussoluca changed the visibility of the branch 3518963-meta-create-the to hidden.

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

@andrewbelcher, this is an interesting approach!

I'm pushing a new MR (https://git.drupalcode.org/project/ai/-/merge_requests/762) with ddev-drupal-contrib artifacts committed and a new command that uses composer require to add a new module to the codebase (similar to ddev poser), for now it is called ai-get-module.

After setting up an environment:

  1. clone ai module
  2. ddev start
  3. ddev poser
  4. ddev symlink-project

If I want to add ai_agents (as a git cloned repo) to work on it, I can run:

ddev ai-get-module drupal/ai_agents:1.1.x-dev@dev from-source

If I just need the module:

ddev ai-get-module drupal/ai_agents:1.1.1

🇮🇹Italy lussoluca Italy

https://github.com/ddev/ddev-drupal-contrib is a very good project and I've used it in all my contrib modules (monolog, webprofiler, ...).

We need to think about pros and cons (in my opinion):

Pros:

  • Well maintained
  • Parity with Drupal's CI testing

Cons:

  • ddev-drupal-contrib suppose you clone only one project at a time. At the moment, cloning multiple modules is not supported (you have to do it manually, by going into web/modules/contrib and run a git clone)
  • if you need some other modules (not the source, just to be installed), you can't, unless they're listed in the require or require-dev section of the module's composer.json
  • ddev-drupal-contrib works better if you commit all the DDEV artifacts it creates. The AI ecosystem is huge, here we're thinking about the AI module, but then we should configure every other module in the same way
  • If we commit DDEV artifacts created by ddev-drupal-contrib, then we have to maintain them (update them every time they change on the source add-on)

Of course, we can find a way to resolve all those issues, but I think that, in the end, this solution will be more complex to maintain and provide a worse DX.

For example, one request from Marcus was:

Its very common that you do not just work on the AI module, but also some contrib module. It would make it easier if I for instance want to work on the OpenAI provider that it gets it from repo sources, so you don't have to uninstall, git clone and reinstall it

The solution proposed in this MR resolves all the issues and will allow us to release new versions of the stack without the need to release a new version of the AI module.

Just to recap, my proposal is:

In the end, for me, it's the same. I'll let Marcus and the community decide :-)

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

I came up with a solution that is more maintainable and powerful (and more in line with what Randy says).

I created a new DDEV add-on for that, but it's designed to be used by every contrib module, not only by the ai module: https://github.com/lussoluca/ddev-drupal-contrib-root (of course, the namespace is temporary; we can place it where we want).

With this new add-on, the only change in the ai module is a CONTRIBUTING.md file: https://git.drupalcode.org/project/ai/-/merge_requests/745/diffs

Pros:

  • No need to commit anything in this repo, we can update the stack without the need for a new AI release
  • Support for working on multiple modules. Useful when a dev needs to work on both ai and ai_agents at the same time (for example)
  • Support for adding temporary modules or recipes without impacting the composer.json file of the ai module
  • We can then write a specific DDEV add-on to support specific use-cases, like the need for a vector database

I've to finish it, but I think this can be the solution.

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

I've added the nullable type hint everywhere is needed

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

Thanks!

I think that we have to decide which pattern we want to implement:

At first, I thought that the first pattern was the one the community was going towards (for example, the Devel module uses it).
However, it is more complex to maintain and adds several unrelated files to the project. So now I'm more in favor of the second.

We can develop a new addon, like ddev-drupal-ai-dev, and add a CONTRIBUTING.md file to this repo. explaining how to use it.

🇮🇹Italy lussoluca Italy

Now, a non-admin key can be used to configure the integration. Of course, the key must have at least access to manage the collection(s) and the documents.

🇮🇹Italy lussoluca Italy

I've prepared a quick recording of a first draft implementation to check if I'm in the right direction.

I'm using the drupal_cms_ai recipe, but maybe it's too much; should we create an ad hoc recipe for this task?

(I still have to check why I have a PHPUnit failure...)

🇮🇹Italy lussoluca Italy

I think that https://github.com/ddev/ddev-drupal-contrib can be a good starting point for this issue.
Then we can add all required ddev addons and initial packages.
Finally, we need a way to install Drupal and install the required recipes

I can work on it :-)

🇮🇹Italy lussoluca Italy

I've removed the sm_test_rate_limiter submodule, and I've added a section in the readme about how to configure the rate limiter

🇮🇹Italy lussoluca Italy

I don't know how to create a MR from here that has the same commits as https://git.drupalcode.org/project/sm/-/merge_requests/33

Anyway, the last commit from https://git.drupalcode.org/project/sm/-/merge_requests/37 is the one you need to fix the issues.

🇮🇹Italy lussoluca Italy

Yes, I saw the announcement. After the #3531660: Drupal SQL/rate limiter/retry-failed/command iteration, I can work on it.

It is one of the missing pieces to replace the core's Queue API (and the advanced queue module)

🇮🇹Italy lussoluca Italy

It seems that I don't have write permissions to drupal-sql branch.
I've created a new fork with the code from drupal-sql where I can add my commits (https://git.drupalcode.org/project/sm/-/merge_requests/36)

🇮🇹Italy lussoluca Italy

I've lowered the PHPStan level to 5 for now.
During the development of other issues, I'll slowly fix all the level 8 issues, and only after they're fixed, I'll raise the level to 8 again.

🇮🇹Italy lussoluca Italy

Yes, the failure and retry feature of sm (with MR 33) covers all the features from the dead_letter_queue module (and more, as sm works with many queue engines other than SQL database).

🇮🇹Italy lussoluca Italy

Those two issues are about improving the facets options on the test search page we currently have in the backend:

I don't plan on improving that search page much beyond the current version. Instead, we can use those ideas for the frontend block.

What do you think?

🇮🇹Italy lussoluca Italy

Merged to 1.0.x-dev, thanks!

I'll release a new version of the module later this week

🇮🇹Italy lussoluca Italy

Thanks for the MR Pieter, very good solution!

I've added the check for null schema in two more places, please review my commit

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

🇮🇹Italy lussoluca Italy

This is probably because services autowiring is not yet a common pattern among Drupal developers :-)

🇮🇹Italy lussoluca Italy

I think this should also be backported to D10. Should I open a new issue or a new merge request?

🇮🇹Italy lussoluca Italy

This MR also contains code from Implement retry Active because it needs support for async transports

🇮🇹Italy lussoluca Italy

I've moved this code into WebProfiler

🇮🇹Italy lussoluca Italy

Close as the module is compatible with PHP up to 8.4

🇮🇹Italy lussoluca Italy

lussoluca made their first commit to this issue’s fork.

Production build 0.71.5 2024