Class AugmentedToolCallback<T extends Record>
java.lang.Object
org.springframework.ai.tool.augment.AugmentedToolCallback<T>
- All Implemented Interfaces:
ToolCallback
This class wraps an existing
ToolCallback and modifies its input schema to
include additional fields defined in the provided Record type. It also provides a
mechanism to handle these extended arguments, either by consuming them via a provided
Consumer or by removing them from the input after processing.- Author:
- Christian Tzolov
-
Field Summary
Fields inherited from interface org.springframework.ai.tool.ToolCallback
logger -
Constructor Summary
ConstructorsConstructorDescriptionAugmentedToolCallback(ToolCallback delegate, Class<T> augmentedArgumentsClass, @Nullable Consumer<AugmentedArgumentEvent<T>> augmentedArgumentsConsumer, boolean removeExtraArgumentsAfterProcessing) -
Method Summary
Modifier and TypeMethodDescriptionExecute tool with the given input and return the result to send back to the AI model.call(String toolInput, @Nullable ToolContext tooContext) Execute tool with the given input and context, and return the result to send back to the AI model.Definition used by the AI model to determine when and how to call the tool.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.tool.ToolCallback
getToolMetadata
-
Constructor Details
-
AugmentedToolCallback
public AugmentedToolCallback(ToolCallback delegate, Class<T> augmentedArgumentsClass, @Nullable Consumer<AugmentedArgumentEvent<T>> augmentedArgumentsConsumer, boolean removeExtraArgumentsAfterProcessing)
-
-
Method Details
-
getToolDefinition
Description copied from interface:ToolCallbackDefinition used by the AI model to determine when and how to call the tool.- Specified by:
getToolDefinitionin interfaceToolCallback
-
call
Description copied from interface:ToolCallbackExecute tool with the given input and return the result to send back to the AI model.- Specified by:
callin interfaceToolCallback
-
call
Description copied from interface:ToolCallbackExecute tool with the given input and context, and return the result to send back to the AI model.- Specified by:
callin interfaceToolCallback
-