🇺🇸United States @michaellander

Account created on 1 November 2009, about 16 years ago
#

Merge Requests

More

Recent comments

🇺🇸United States michaellander

Maybe the tool could live in the ai_search module?

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

I added test coverage.

🇺🇸United States michaellander

The Tool Explorer module has been added, can can be accessed at /admin/config/tool/explorer.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

Good to know! I'm proposing removing the _sleep() method override in this particular case, so win-win.

🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander

Also worth noting, if you look at \Drupal\Core\TypedData\ListDataDefinition, we do not unset itemDefinition during serialization. Which means there's a discrepancy between how they are handling their child definitions.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

I've been experimenting with some different versions of just that, though I do believe it differs from the agent tool dynamic discussion.

Instead of giving the LLM all the tools, I just exposed 3 tools: tool_list, tool_plan, and tool_execute. The LLM can use list to find the right one, plan to make sure it understands the tool and execute to actually call the tool. I had pretty good results, though I only pushed it so far. I think as the library of tools grows, we can definitely get creative here.

I could certainly use some help on the categorization/grouping side. I want to introduce the concept of 'Toolsets', but again, outside the scope of this conversation.

🇺🇸United States michaellander

I'm of the belief that the overlap between Agents and Tools is pretty significant and we could potentially reuse some of those parts from Tool API for our agent approach. I really see an agent as a composite tool, that just uses AI to determine which(subtools) to use. It also has the benefit of additional context/prompting/etc that a single individual tool is lacking.

I put together an example of what an agent definition/plugin could look like:

namespace Drupal\ai_agents\Plugin\agent\Agent;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\tool\TypedData\EntityInputDefinition;

/**
* Plugin implementation of an example agent.
 */
#[Agent(
  id: 'example',
  label: new TranslatableMarkup('Example'),
  description: new TranslatableMarkup('Does example stuff'),
  prompt: '.......',
  provider: Provider::SITE_DEFAULT,
  max_retries: 3,
  input_definitions: [
    'entity' => new EntityInputDefinition(
      data_type: 'entity:node',
      label: new TranslatableMarkup("Node"),
      required: TRUE,
      description: new TranslatableMarkup("The node entity"),
    ),
  ],
  tools: [
    // Attach by Tool ID.
    'tool_debug.example_tool',
    // Attach with additional configuration.
    Agent::attachTool(
      id: 'tool_debug.example_tool_2',
      prompt: '...',
    ),
    // Attach a Sub-Agent.
    Agent::attachSubAgent(
      id: 'tool_debug.example_sub_agent',
      tools: [
        'tool_debug.example_tool_3',
      ],
    ),
  ],
  output_definitions: [
    'updated_entity' => new EntityInputDefinition(
      data_type: 'entity:node',
      label: new TranslatableMarkup("Node"),
      required: TRUE,
      description: new TranslatableMarkup("The node entity"),
    ),
  ],
)]
class Example extends AgentBase {
  // Nothing necessarily has to be here if you just want it to use the tools.

}

By getting the definition in a good place, where one can easily define an agent without any additional behavior in the class, and allow prompts/overrides/constraints/etc. We can really nail the agent pattern and then the UI should fall into place rather easily.

🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

See 📌 Remove 'Exists' condition tools Fixed .

🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → changed the visibility of the branch 3550861-tools-create-fieldadd to hidden.

🇺🇸United States michaellander

Accidentally pushed to 1.0.x.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → changed the visibility of the branch 3556855-create-distinction-between to hidden.

🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander

Accidentally pushed into 1.0.x directly. That's my bad.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander

Do we need to add toArray() to the \Drupal\Core\TypedData\DataDefinitionInterface()? I'm needing either toArray() or offsetGet() but the former isn't under contract.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

Thanks for this. Will review this week.

🇺🇸United States michaellander

Thanks for this. Will review this week.

🇺🇸United States michaellander

Merged in everything targeting Level 3.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → made their first commit to this issue’s fork.

🇺🇸United States michaellander

Yay!

🇺🇸United States michaellander

michaellander → made their first commit to this issue’s fork.

🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

This fixes this specific issue, but we should probably add test coverage and try more versions of this(maps for example) with constraints.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander
🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

I would like to opt-in this module: https://www.drupal.org/project/tool →
It has 48 total issues, and all maintainers agree we are ready to try GitLab issues. We understand we cannot revert this change and there may be some unexpected issues as early adopters.

🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

There are a few PHPStan flags that I'm not sure the best way to fix. The one about using \Drupal to get the tempstore service is intentional, however, as I would like to replace the token stuff with a common API that works across modules and don't want to tie the tempstore service into the dependency injection until a unified solution is in place.

🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander
🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander
🇺🇸United States michaellander

This branch depends on 📌 Determine path forward for turning Attributes into JSON schema Active , which I'm hoping to have fixed shortly.

🇺🇸United States michaellander

I pushed up the normalizer's I'm testing, they are working but are not complete.

🇺🇸United States michaellander

Worth noting, one of the changes is that the exhaustive tool list would not live on the page but instead in a modal/tray. So the tools displayed here are only the ones added to the agent. So while the amount of tools will grow, the amount used on the agent will just be a small subset of the total amount of tools. I'm open to putting them on a tab, I just don't think it's going to be a significant issue either way.

🇺🇸United States michaellander

I was running into issues where the Gemini CLI schema validation is more strict than other clients. In my case, there were additional schema properties such as 'name' that I had to remove recursively and a missing parameters property in some cases.

This was happening when using MCP with AI Function Calls, and I did not get to go further than that yet.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

I have a version of this for Tool API. It was put on the back burner temporarily but I'm delving back into it. I think we need to connect it in a way that leaves it up to the tools plugin to determine the configuration form for per-instance configuration. For example, when adding an existing function call, we can use a form similar to what we have currently. When adding an agent tool, the experience may differ, when adding a Tool API tool, we can inherit the refinement form from that module. If there are specific form elements that you want to persist across all tools, then we can just embed the per tool-type form within a shared form.

That's my opinion right now at least.. I'll work on getting the Tool API version back up and running so you can see it.

🇺🇸United States michaellander

I've updated the original topic to reflect the solution that went into the module. I think overall it's a win-win in that we can lean on data type validations, but also communicate those dependencies to UI/AI/etc.

🇺🇸United States michaellander

Also noting, we are using the AI normalizer in a few places currently without the dependency in place for Tool API, which I'm not intended on adding. That makes this extra important to solve independently of any one tool caller.

🇺🇸United States michaellander

Fixed. The solution I landed on varies slightly from the original post. Will get that updated shortly.

🇺🇸United States michaellander

michaellander → changed the visibility of the branch 3545828-introduce-dynamic-tools to hidden.

🇺🇸United States michaellander

Added an initial set of tools, though some of which are going to be dependent on 🌱 Introduce Dynamic Tools Active . We can still start building them as it won't cause much backtracking, just additional refinement.

If these go quick or we get more help, we can definitely consider doing even more from:
https://docs.google.com/spreadsheets/d/18knLUFa2uUll_nOe4yGFPjDBQmDvqJtM...

🇺🇸United States michaellander

michaellander → created an issue.

🇺🇸United States michaellander

michaellander → created an issue.

Production build 0.71.5 2024