Class VertexToolCallingManager

java.lang.Object
org.springframework.ai.vertexai.gemini.schema.VertexToolCallingManager
All Implemented Interfaces:
ToolCallingManager

public class VertexToolCallingManager extends Object implements ToolCallingManager
Implementation of ToolCallingManager specifically designed for Vertex AI Gemini. This manager adapts tool definitions to be compatible with Vertex AI's OpenAPI schema format by converting JSON schemas and ensuring proper type value upper-casing.

It delegates the actual tool execution to another ToolCallingManager while handling the necessary schema conversions for Vertex AI compatibility.

Since:
1.0.0
Author:
Christian Tzolov
  • Constructor Details

    • VertexToolCallingManager

      public VertexToolCallingManager(ToolCallingManager delegateToolCallingManager)
      Creates a new instance of VertexToolCallingManager.
      Parameters:
      delegateToolCallingManager - the underlying tool calling manager that handles actual tool execution
  • Method Details

    • resolveToolDefinitions

      public List<ToolDefinition> resolveToolDefinitions(ToolCallingChatOptions chatOptions)
      Resolves tool definitions and converts their input schemas to be compatible with Vertex AI's OpenAPI format. This includes converting JSON schemas to OpenAPI format and ensuring proper type value casing.
      Specified by:
      resolveToolDefinitions in interface ToolCallingManager
      Parameters:
      chatOptions - the options containing tool preferences and configurations
      Returns:
      a list of tool definitions with Vertex AI compatible schemas
    • executeToolCalls

      public ToolExecutionResult executeToolCalls(Prompt prompt, ChatResponse chatResponse)
      Executes tool calls by delegating to the underlying tool calling manager.
      Specified by:
      executeToolCalls in interface ToolCallingManager
      Parameters:
      prompt - the original prompt that triggered the tool calls
      chatResponse - the chat response containing the tool calls to execute
      Returns:
      the result of executing the tool calls