Class ToolNode
java.lang.Object
org.bsc.langgraph4j.langchain4j.tool.ToolNode
Deprecated, for removal: This API element is subject to removal in a future version.
A node in the graph that executes a tool
This class is just a simple wrapper around a list of ToolNode.Specification that can be used to build a node
in a graph that can execute a tool with the given id.
The node will execute the first tool that has the given id.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.static final recordDeprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolNode.Builderbuilder()Deprecated, for removal: This API element is subject to removal in a future version.Optional<dev.langchain4j.data.message.ToolExecutionResultMessage>execute(dev.langchain4j.agent.tool.ToolExecutionRequest request) Deprecated, for removal: This API element is subject to removal in a future version.Executes the first matching toolOptional<dev.langchain4j.data.message.ToolExecutionResultMessage>Deprecated, for removal: This API element is subject to removal in a future version.Executes the first matching toolOptional<dev.langchain4j.data.message.ToolExecutionResultMessage>execute(Collection<dev.langchain4j.agent.tool.ToolExecutionRequest> requests) Deprecated, for removal: This API element is subject to removal in a future version.Executes the first matching toolOptional<dev.langchain4j.data.message.ToolExecutionResultMessage>execute(Collection<dev.langchain4j.agent.tool.ToolExecutionRequest> requests, Object memoryId) Deprecated, for removal: This API element is subject to removal in a future version.Executes the first matching toolstatic ToolNodeDeprecated.usebuilder()static ToolNodeof(Collection<Object> objectsWithToolsOrSpecification) Deprecated.usebuilder()List<dev.langchain4j.agent.tool.ToolSpecification>Deprecated, for removal: This API element is subject to removal in a future version.Returns a list ofToolSpecifications that can be executed by this node
-
Method Details
-
builder
Deprecated, for removal: This API element is subject to removal in a future version. -
of
Deprecated.usebuilder()Builds a ToolNode out of a collection of objects that have tools attached or a tool specification- Parameters:
objectsWithToolsOrSpecification- a list of objects with tools- Returns:
- a ToolNode
-
of
Deprecated.usebuilder()Builds a ToolNode out of a array of objects that have tools attached or a tool specification- Parameters:
objectsWithToolsOrSpecification- a list of objects with tools- Returns:
- a ToolNode
-
toolSpecifications
Deprecated, for removal: This API element is subject to removal in a future version.Returns a list ofToolSpecifications that can be executed by this node- Returns:
- a list of tool specifications
-
execute
public Optional<dev.langchain4j.data.message.ToolExecutionResultMessage> execute(dev.langchain4j.agent.tool.ToolExecutionRequest request, Object memoryId) Deprecated, for removal: This API element is subject to removal in a future version.Executes the first matching tool- Parameters:
request- the request to executememoryId- the memory id to pass to the tool- Returns:
- the result of the tool
-
execute
public Optional<dev.langchain4j.data.message.ToolExecutionResultMessage> execute(Collection<dev.langchain4j.agent.tool.ToolExecutionRequest> requests, Object memoryId) Deprecated, for removal: This API element is subject to removal in a future version.Executes the first matching tool- Parameters:
requests- the requests to executememoryId- the memory id to pass to the tool- Returns:
- the result of the tool
-
execute
public Optional<dev.langchain4j.data.message.ToolExecutionResultMessage> execute(dev.langchain4j.agent.tool.ToolExecutionRequest request) Deprecated, for removal: This API element is subject to removal in a future version.Executes the first matching tool- Parameters:
request- the request to execute- Returns:
- the result of the tool
-
execute
public Optional<dev.langchain4j.data.message.ToolExecutionResultMessage> execute(Collection<dev.langchain4j.agent.tool.ToolExecutionRequest> requests) Deprecated, for removal: This API element is subject to removal in a future version.Executes the first matching tool- Parameters:
requests- the requests to execute- Returns:
- the result of the tool
-
LC4jToolService