Class AbstractFunctionCallSupport<Msg,Req,Resp>

java.lang.Object
org.springframework.ai.model.function.AbstractFunctionCallSupport<Msg,Req,Resp>
Direct Known Subclasses:
AzureOpenAiChatClient, MistralAiChatClient, OpenAiChatClient, VertexAiGeminiChatClient

public abstract class AbstractFunctionCallSupport<Msg,Req,Resp> extends Object
Author:
Christian Tzolov
  • Field Details

    • IS_RUNTIME_CALL

      protected static final boolean IS_RUNTIME_CALL
      See Also:
    • functionCallbackRegister

      protected final Map<String,FunctionCallback> functionCallbackRegister
      The function callback register is used to resolve the function callbacks by name.
    • functionCallbackContext

      protected final FunctionCallbackContext functionCallbackContext
      The function callback context is used to resolve the function callbacks by name from the Spring context. It is optional and usually used with Spring auto-configuration.
  • Constructor Details

    • AbstractFunctionCallSupport

      public AbstractFunctionCallSupport(FunctionCallbackContext functionCallbackContext)
  • Method Details

    • getFunctionCallbackRegister

      public Map<String,FunctionCallback> getFunctionCallbackRegister()
    • handleFunctionCallbackConfigurations

      protected Set<String> handleFunctionCallbackConfigurations(FunctionCallingOptions options, boolean isRuntimeCall)
    • resolveFunctionCallbacks

      protected List<FunctionCallback> resolveFunctionCallbacks(Set<String> functionNames)
      Resolve the function callbacks by name. Retrieve them from the registry or try to resolve them from the Application Context.
      Parameters:
      functionNames - Name of function callbacks to retrieve.
      Returns:
      list of resolved FunctionCallbacks.
    • callWithFunctionSupport

      protected Resp callWithFunctionSupport(Req request)
    • handleFunctionCallOrReturn

      protected Resp handleFunctionCallOrReturn(Req request, Resp response)
    • doCreateToolResponseRequest

      protected abstract Req doCreateToolResponseRequest(Req previousRequest, Msg responseMessage, List<Msg> conversationHistory)
    • doGetUserMessages

      protected abstract List<Msg> doGetUserMessages(Req request)
    • doGetToolResponseMessage

      protected abstract Msg doGetToolResponseMessage(Resp response)
    • doChatCompletion

      protected abstract Resp doChatCompletion(Req request)
    • isToolFunctionCall

      protected abstract boolean isToolFunctionCall(Resp response)