Class FunctionCallbackWrapper<I,O>
java.lang.Object
org.springframework.ai.model.function.FunctionCallbackWrapper<I,O>
- Type Parameters:
I
- the input typeO
- the output type
- All Implemented Interfaces:
BiFunction<I,
,ToolContext, O> FunctionCallback
Deprecated.
Note that the underlying function is responsible for converting the output into format
that can be consumed by the Model. The default implementation converts the output into
String before sending it to the Model. Provide a custom function responseConverter
implementation to override this.
- Author:
- Christian Tzolov, Sebastien Deleuze
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Deprecated.in favor ofDefaultFunctionCallbackBuilder
Nested classes/interfaces inherited from interface org.springframework.ai.model.function.FunctionCallback
FunctionCallback.FunctionInvokingSpec<I,
O>, FunctionCallback.MethodInvokingSpec -
Method Summary
Modifier and TypeMethodDescriptionapply
(I input, ToolContext context) Deprecated.static <I,
O> FunctionCallbackWrapper.Builder<I, O> builder
(BiFunction<I, ToolContext, O> biFunction) Deprecated.useFunctionCallback.builder()
instead.static <I,
O> FunctionCallbackWrapper.Builder<I, O> Deprecated.useFunctionCallback.builder()
instead.Called when a model detects and triggers a function call.call
(String functionInput, ToolContext toolContext) Called when a model detects and triggers a function call.boolean
getName()
int
hashCode()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiFunction
andThen
-
Method Details
-
apply
Deprecated. -
builder
@Deprecated public static <I,O> FunctionCallbackWrapper.Builder<I,O> builder(BiFunction<I, ToolContext, O> biFunction) Deprecated.useFunctionCallback.builder()
instead. -
builder
@Deprecated public static <I,O> FunctionCallbackWrapper.Builder<I,O> builder(Function<I, O> function) Deprecated.useFunctionCallback.builder()
instead.Create a newFunctionCallbackWrapper
instance. -
getName
- Specified by:
getName
in interfaceFunctionCallback
- Returns:
- Returns the Function name. Unique within the model.
-
getDescription
- Specified by:
getDescription
in interfaceFunctionCallback
- Returns:
- Returns the function description. This description is used by the model do decide if the function should be called or not.
-
getInputTypeSchema
- Specified by:
getInputTypeSchema
in interfaceFunctionCallback
- Returns:
- Returns the JSON schema of the function input type.
-
call
Description copied from interface:FunctionCallback
Called when a model detects and triggers a function call. The model is responsible to pass the function arguments in the pre-configured JSON schema format. Additionally, the model can pass a context map to the function if available. The context is used to pass additional user provided state in addition to the arguments provided by the AI model.- Specified by:
call
in interfaceFunctionCallback
- Parameters:
functionInput
- JSON string with the function arguments to be passed to the function. The arguments are defined as JSON schema usually registered with the model. Arguments are provided by the AI model.toolContext
- Map with the function context. The context is used to pass additional user provided state in addition to the arguments provided by the AI model.- Returns:
- String containing the function call response.
-
call
Description copied from interface:FunctionCallback
Called when a model detects and triggers a function call. The model is responsible to pass the function arguments in the pre-configured JSON schema format.- Specified by:
call
in interfaceFunctionCallback
- Parameters:
functionArguments
- JSON string with the function arguments to be passed to the function. The arguments are defined as JSON schema usually registered with the model.- Returns:
- String containing the function call response.
-
hashCode
public int hashCode() -
equals
-
FunctionCallbackWrapper.Builder