Tool calling does not work

Created on 17 June 2025, 4 months ago

Problem/Motivation

The Vertex provider is not properly interfacing with Google's Vertex AI API schema. When setting message content, you may only specify user or model https://cloud.google.com/vertex-ai/docs/reference/rest/v1/Content.

When a tool should be called, $message->getRole() will be tool. This causes a 400 response.

https://git.drupalcode.org/project/ai_provider_google_vertex/-/blob/1.1....

Steps to reproduce

Create an agent that uses a tool, have a conversation that causes a tool to be used, get an exception.

Proposed resolution

Make the code more robust and strictly adhere to the Vertex AI API spec.

Remaining tasks

  • Update the provider chat implementation to properly identify tool usage and format the payload accordingly.
πŸ› Bug report
Status

Active

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States lpeabody

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

Merge Requests

Comments & Activities

  • Issue created by @lpeabody
  • πŸ‡ΊπŸ‡ΈUnited States lpeabody
  • πŸ‡ΊπŸ‡ΈUnited States lpeabody
  • First commit to issue fork.
  • Pipeline finished with Failed
    2 months ago
    #562297
  • First commit to issue fork.
  • Pipeline finished with Failed
    2 months ago
    #564238
  • Pipeline finished with Failed
    2 months ago
    #564241
  • Pipeline finished with Failed
    2 months ago
    #564246
  • πŸ‡¬πŸ‡§United Kingdom MrDaleSmith

    I've tried to fix the failing tests on this, but cspell is an abomination and will not ignore the word "blacklist" which isn't in the project but the word "git_blacklist" does aoppear in the grumphp.yml file: presumably there is someway of getting cspell to ignore this file?

    There was an additional issue in the Provider codebase that caused an error when I tried to use tool calling with the AI Provider: all tool parameters were being added as required fields, which meant any optional fields caused an error if they were missing from a valid AI response. Fixing that, and I have managed to get the AI Assistant to create a new content typed called "Tester" from the prompt "Create a content type called Tester" without erroring.

  • Pipeline finished with Failed
    2 months ago
    #564324
  • Pipeline finished with Success
    2 months ago
    Total: 144s
    #565233
  • πŸ‡­πŸ‡ΊHungary yce

    I've found a way to ignore the forbidden word, pushed to the MR.

  • Status changed to RTBC about 1 month ago
  • πŸ‡ΊπŸ‡ΈUnited States lpeabody

    Confirmed this is fixed by replacing my original patch with the MR diff in my composer.json.

    • yce β†’ committed 20af5873 on 1.1.x
      Issue #3530565 by lpeabody: Tool calling does not work
      
  • Now that this issue is closed, please review the contribution record.

    As a contributor, attribute any organization helped you, or if you volunteered your own time.

    Maintainers, please credit people who helped resolve this issue.

Production build 0.71.5 2024