Class VertexToolCallingManager
java.lang.Object
org.springframework.ai.vertexai.gemini.schema.VertexToolCallingManager
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionVertexToolCallingManager
(ToolCallingManager delegateToolCallingManager) Creates a new instance of VertexToolCallingManager. -
Method Summary
Modifier and TypeMethodDescriptionexecuteToolCalls
(Prompt prompt, ChatResponse chatResponse) Executes tool calls by delegating to the underlying tool calling manager.resolveToolDefinitions
(ToolCallingChatOptions chatOptions) Resolves tool definitions and converts their input schemas to be compatible with Vertex AI's OpenAPI format.
-
Constructor Details
-
VertexToolCallingManager
Creates a new instance of VertexToolCallingManager.- Parameters:
delegateToolCallingManager
- the underlying tool calling manager that handles actual tool execution
-
-
Method Details
-
resolveToolDefinitions
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 interfaceToolCallingManager
- Parameters:
chatOptions
- the options containing tool preferences and configurations- Returns:
- a list of tool definitions with Vertex AI compatible schemas
-
executeToolCalls
Executes tool calls by delegating to the underlying tool calling manager.- Specified by:
executeToolCalls
in interfaceToolCallingManager
- Parameters:
prompt
- the original prompt that triggered the tool callschatResponse
- the chat response containing the tool calls to execute- Returns:
- the result of executing the tool calls
-