Class DefaultCommonCallbackInvokingSpec<B extends FunctionCallback.CommonCallbackInvokingSpec<B>>
java.lang.Object
org.springframework.ai.model.function.DefaultCommonCallbackInvokingSpec<B>
- All Implemented Interfaces:
FunctionCallback.CommonCallbackInvokingSpec<B>
public class DefaultCommonCallbackInvokingSpec<B extends FunctionCallback.CommonCallbackInvokingSpec<B>>
extends Object
implements FunctionCallback.CommonCallbackInvokingSpec<B>
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
The description of the function callback.protected String
(Optional) Instead of generating the input type schema from the input type or method argument types, you can provide the schema directly.protected com.fasterxml.jackson.databind.ObjectMapper
The function to convert the response object to a string.protected FunctionCallback.SchemaType
The schema type to use for the input type schema generation. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondescription
(String description) Function description.com.fasterxml.jackson.databind.ObjectMapper
inputTypeSchema
(String inputTypeSchema) You can provide the Input Type Schema directly.objectMapper
(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Custom object mapper for JSON operations.responseConverter
(Function<Object, String> responseConverter) Function response converter.schemaType
(FunctionCallback.SchemaType schemaType) Specifies whatFunctionCallback.SchemaType
is used by the AI model to validate the function input arguments.
-
Field Details
-
description
The description of the function callback. Used to hint the LLM model about the tool's purpose and when to use it. -
schemaType
The schema type to use for the input type schema generation. The default is JSON Schema. Note: Vertex AI requires the input type schema to be in Open API schema -
responseConverter
The function to convert the response object to a string. The default is to convert the response to a JSON string. -
inputTypeSchema
(Optional) Instead of generating the input type schema from the input type or method argument types, you can provide the schema directly. This will override the generated schema. -
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
DefaultCommonCallbackInvokingSpec
public DefaultCommonCallbackInvokingSpec()
-
-
Method Details
-
description
Description copied from interface:FunctionCallback.CommonCallbackInvokingSpec
Function description. This description is used by the model to decide if the function should be called or not.- Specified by:
description
in interfaceFunctionCallback.CommonCallbackInvokingSpec<B extends FunctionCallback.CommonCallbackInvokingSpec<B>>
-
schemaType
Description copied from interface:FunctionCallback.CommonCallbackInvokingSpec
Specifies whatFunctionCallback.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.CommonCallbackInvokingSpec<B extends FunctionCallback.CommonCallbackInvokingSpec<B>>
-
responseConverter
Description copied from interface:FunctionCallback.CommonCallbackInvokingSpec
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.CommonCallbackInvokingSpec<B extends FunctionCallback.CommonCallbackInvokingSpec<B>>
-
inputTypeSchema
Description copied from interface:FunctionCallback.CommonCallbackInvokingSpec
You can provide the Input Type Schema directly. In this case it won't be generated from the inputType.- Specified by:
inputTypeSchema
in interfaceFunctionCallback.CommonCallbackInvokingSpec<B extends FunctionCallback.CommonCallbackInvokingSpec<B>>
-
objectMapper
Description copied from interface:FunctionCallback.CommonCallbackInvokingSpec
Custom object mapper for JSON operations.- Specified by:
objectMapper
in interfaceFunctionCallback.CommonCallbackInvokingSpec<B extends FunctionCallback.CommonCallbackInvokingSpec<B>>
-
getDescription
-
getSchemaType
-
getResponseConverter
-
getInputTypeSchema
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
-