Class FunctionToolCallback<I,O> 
java.lang.Object
org.springframework.ai.tool.function.FunctionToolCallback<I,O> 
- All Implemented Interfaces:
- ToolCallback
A 
ToolCallback implementation to invoke functions as tools.- Since:
- 1.0.0
- Author:
- Thomas Vitale, YunKui Lu
- 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructorsConstructorDescriptionFunctionToolCallback(ToolDefinition toolDefinition, ToolMetadata toolMetadata, Type toolInputType, BiFunction<I, ToolContext, O> toolFunction, ToolCallResultConverter toolCallResultConverter) 
- 
Method SummaryModifier and TypeMethodDescriptionstatic <I,O> FunctionToolCallback.Builder<I, O> builder(String name, BiFunction<I, ToolContext, O> function) Build aFunctionToolCallbackfrom aBiFunction.static <I> FunctionToolCallback.Builder<I,Void> Build aFunctionToolCallbackfrom aConsumer.static <I,O> FunctionToolCallback.Builder<I, O> Build aFunctionToolCallbackfrom aFunction.static <O> FunctionToolCallback.Builder<Void,O> Build aFunctionToolCallbackfrom aSupplier.Execute tool with the given input and return the result to send back to the AI model.call(String toolInput, ToolContext toolContext) 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.Metadata providing additional information on how to handle the tool.toString()
- 
Constructor Details- 
FunctionToolCallbackpublic FunctionToolCallback(ToolDefinition toolDefinition, @Nullable ToolMetadata toolMetadata, Type toolInputType, BiFunction<I, ToolContext, O> toolFunction, @Nullable ToolCallResultConverter toolCallResultConverter) 
 
- 
- 
Method Details- 
getToolDefinitionDescription copied from interface:ToolCallbackDefinition used by the AI model to determine when and how to call the tool.- Specified by:
- getToolDefinitionin interface- ToolCallback
 
- 
getToolMetadataDescription copied from interface:ToolCallbackMetadata providing additional information on how to handle the tool.- Specified by:
- getToolMetadatain interface- ToolCallback
 
- 
callDescription copied from interface:ToolCallbackExecute tool with the given input and return the result to send back to the AI model.- Specified by:
- callin interface- ToolCallback
 
- 
callDescription 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 interface- ToolCallback
 
- 
toString
- 
builderpublic static <I,O> FunctionToolCallback.Builder<I,O> builder(String name, BiFunction<I, ToolContext, O> function) Build aFunctionToolCallbackfrom aBiFunction.
- 
builderBuild aFunctionToolCallbackfrom aFunction.
- 
builderBuild aFunctionToolCallbackfrom aSupplier.
- 
builderBuild aFunctionToolCallbackfrom aConsumer.
 
-