Class SpringAIToolService
java.lang.Object
org.bsc.langgraph4j.spring.ai.tool.SpringAIToolService
Service class responsible for managing tools and their callbacks.
-
Constructor Summary
ConstructorsConstructorDescriptionSpringAIToolService(List<org.springframework.ai.tool.ToolCallback> agentFunctions) -
Method Summary
Modifier and TypeMethodDescriptionOptional<org.springframework.ai.tool.ToolCallback>agentFunction(String name) Retrieves a specific function callback wrapper by name.List<org.springframework.ai.tool.ToolCallback>Retrieves all registered function callback wrappers.executeFunctions(List<org.springframework.ai.chat.messages.AssistantMessage.ToolCall> toolCalls, Map<String, Object> toolContextData) executeFunctions(List<org.springframework.ai.chat.messages.AssistantMessage.ToolCall> toolCalls, Map<String, Object> toolContextData, String propertyNameToUpdate) Executes a list of tool calls.
-
Constructor Details
-
SpringAIToolService
-
-
Method Details
-
agentFunctionsCallback
Retrieves all registered function callback wrappers.- Returns:
- A list of function callback wrappers.
-
agentFunction
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
-