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 Details

    • DefaultFunctionCallbackResolver

      public DefaultFunctionCallbackResolver()
  • Method Details

    • setSchemaType

      public void setSchemaType(FunctionCallback.SchemaType schemaType)
    • setApplicationContext

      public void setApplicationContext(@NonNull org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • resolve

      public FunctionCallback resolve(@NonNull String beanName)
      Description copied from interface: FunctionCallbackResolver
      Resolve the FunctionCallback instance by its name.
      Specified by:
      resolve in interface FunctionCallbackResolver
      Parameters:
      beanName - the name of the function to resolve
      Returns:
      the FunctionCallback instance