Class FunctionCallbackWrapper<I,O>

java.lang.Object
org.springframework.ai.model.function.FunctionCallbackWrapper<I,O>
All Implemented Interfaces:
Function<I,O>, FunctionCallback

public class FunctionCallbackWrapper<I,O> extends Object
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.
  • Constructor Details

  • Method Details

    • apply

      public O apply(I input)
    • getName

      public String getName()
      Specified by:
      getName in interface FunctionCallback
      Returns:
      Returns the Function name. Unique within the model.
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface FunctionCallback
      Returns:
      Returns the function description. This description is used by the model do decide if the function should be called or not.
    • getInputTypeSchema

      public String getInputTypeSchema()
      Specified by:
      getInputTypeSchema in interface FunctionCallback
      Returns:
      Returns the JSON schema of the function input type.
    • call

      public String call(String functionArguments)
      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 interface FunctionCallback
      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 the model.
      Returns:
      String containing the function call response.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object