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.
Incorporating a tools response, $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.
Comments
Comment #2
lpeabody commentedComment #3
lpeabody commentedComment #7
mrdalesmith commentedI'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.
Comment #8
yce commentedI've found a way to ignore the forbidden word, pushed to the MR.
Comment #9
lpeabody commentedConfirmed this is fixed by replacing my original patch with the MR diff in my composer.json.
Comment #11
yce commented