Class DefaultFunctionCallbackResolver
java.lang.Object
org.springframework.ai.model.function.DefaultFunctionCallbackResolver
- All Implemented Interfaces:
FunctionCallbackResolver
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class DefaultFunctionCallbackResolver
extends Object
implements org.springframework.context.ApplicationContextAware, FunctionCallbackResolver
A Spring
ApplicationContextAware
implementation that provides a way to retrieve
a Function
from the Spring context and wrap it into a FunctionCallback
.
The name of the function is determined by the bean name.
The description of the function is determined by the following rules:
- Provided as a default description
- Provided as a
@Description
annotation on the bean - Provided as a
@JsonClassDescription
annotation on the input class
- Author:
- Christian Tzolov, Christopher Smith, Sebastien Deleuze
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionResolve theFunctionCallback
instance by its name.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setSchemaType
(FunctionCallback.SchemaType schemaType)
-
Constructor Details
-
DefaultFunctionCallbackResolver
public DefaultFunctionCallbackResolver()
-
-
Method Details
-
setSchemaType
-
setApplicationContext
public void setApplicationContext(@NonNull org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
resolve
Description copied from interface:FunctionCallbackResolver
Resolve theFunctionCallback
instance by its name.- Specified by:
resolve
in interfaceFunctionCallbackResolver
- Parameters:
beanName
- the name of the function to resolve- Returns:
- the
FunctionCallback
instance
-