Class DefaultFunctionCallbackBuilder
java.lang.Object
org.springframework.ai.model.function.DefaultFunctionCallbackBuilder
- All Implemented Interfaces:
FunctionCallback.Builder
Default implementation of the
FunctionCallback.Builder
.- Since:
- 1.0.0
- Author:
- Christian Tzolov
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondescription
(String description) Function description.<I,
O> FunctionCallback.FunctionInvokingSpec<I, O> function
(String name, BiFunction<I, ToolContext, O> biFunction) Builds aBiFunction
invokingFunctionCallback
instance.Builds aConsumer
invokingFunctionCallback
instance.<I,
O> FunctionCallback.FunctionInvokingSpec<I, O> Builds aFunction
invokingFunctionCallback
instance.Builds aSupplier
invokingFunctionCallback
instance.inputTypeSchema
(String inputTypeSchema) You can provide the Input Type Schema directly.Builds a Method invokingFunctionCallback
instance.objectMapper
(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Custom object mapper for JSON operations.responseConverter
(Function<Object, String> responseConverter) Function response converter.schemaType
(FunctionCallbackContext.SchemaType schemaType) Specifies whatFunctionCallbackContext.SchemaType
is used by the AI model to validate the function input arguments.
-
Constructor Details
-
DefaultFunctionCallbackBuilder
public DefaultFunctionCallbackBuilder()
-
-
Method Details
-
description
Description copied from interface:FunctionCallback.Builder
Function description. This description is used by the model do decide if the function should be called or not.- Specified by:
description
in interfaceFunctionCallback.Builder
-
schemaType
Description copied from interface:FunctionCallback.Builder
Specifies whatFunctionCallbackContext.SchemaType
is used by the AI model to validate the function input arguments. Most models use JSON Schema, except Vertex AI that uses OpenAPI types.- Specified by:
schemaType
in interfaceFunctionCallback.Builder
-
responseConverter
Description copied from interface:FunctionCallback.Builder
Function response converter. The default implementation converts the output into String before sending it to the Model. Provide a custom function responseConverter implementation to override this.- Specified by:
responseConverter
in interfaceFunctionCallback.Builder
-
inputTypeSchema
Description copied from interface:FunctionCallback.Builder
You can provide the Input Type Schema directly. In this case it won't be generated from the inputType.- Specified by:
inputTypeSchema
in interfaceFunctionCallback.Builder
-
objectMapper
public FunctionCallback.Builder objectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Description copied from interface:FunctionCallback.Builder
Custom object mapper for JSON operations.- Specified by:
objectMapper
in interfaceFunctionCallback.Builder
-
function
public <I,O> FunctionCallback.FunctionInvokingSpec<I,O> function(String name, Function<I, O> function) Description copied from interface:FunctionCallback.Builder
Builds aFunction
invokingFunctionCallback
instance.- Specified by:
function
in interfaceFunctionCallback.Builder
-
function
public <I,O> FunctionCallback.FunctionInvokingSpec<I,O> function(String name, BiFunction<I, ToolContext, O> biFunction) Description copied from interface:FunctionCallback.Builder
Builds aBiFunction
invokingFunctionCallback
instance.- Specified by:
function
in interfaceFunctionCallback.Builder
-
function
public <O> FunctionCallback.FunctionInvokingSpec<Void,O> function(String name, Supplier<O> supplier) Description copied from interface:FunctionCallback.Builder
Builds aSupplier
invokingFunctionCallback
instance.- Specified by:
function
in interfaceFunctionCallback.Builder
-
function
public <I> FunctionCallback.FunctionInvokingSpec<I,Void> function(String name, Consumer<I> consumer) Description copied from interface:FunctionCallback.Builder
Builds aConsumer
invokingFunctionCallback
instance.- Specified by:
function
in interfaceFunctionCallback.Builder
-
method
Description copied from interface:FunctionCallback.Builder
Builds a Method invokingFunctionCallback
instance.- Specified by:
method
in interfaceFunctionCallback.Builder
-