Class SpringAIToolService

java.lang.Object
org.bsc.langgraph4j.spring.ai.tool.SpringAIToolService

public class SpringAIToolService extends Object
Service class responsible for managing tools and their callbacks.
  • Constructor Details

    • SpringAIToolService

      public SpringAIToolService(List<org.springframework.ai.tool.ToolCallback> agentFunctions)
  • Method Details

    • agentFunctionsCallback

      public List<org.springframework.ai.tool.ToolCallback> agentFunctionsCallback()
      Retrieves all registered function callback wrappers.
      Returns:
      A list of function callback wrappers.
    • agentFunction

      public Optional<org.springframework.ai.tool.ToolCallback> agentFunction(String name)
      Retrieves a specific function callback wrapper by name.
      Parameters:
      name - The name of the function callback to retrieve.
      Returns:
      An optional containing the function callback wrapper, or an empty optional if not found.
    • executeFunctions

      public CompletableFuture<Command> executeFunctions(List<org.springframework.ai.chat.messages.AssistantMessage.ToolCall> toolCalls, Map<String,Object> toolContextData, String propertyNameToUpdate)
      Executes a list of tool calls.
      Parameters:
      toolCalls - The list of tool calls to execute.
      toolContextData - The tool context data.
      propertyNameToUpdate - name of the state property where ste the tool response message
      Returns:
      A completable future that will be completed with the tool response message.
    • executeFunctions

      public CompletableFuture<Command> executeFunctions(List<org.springframework.ai.chat.messages.AssistantMessage.ToolCall> toolCalls, Map<String,Object> toolContextData)