Class LC4jToolService
java.lang.Object
org.bsc.langgraph4j.langchain4j.tool.LC4jToolService
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder forLC4jToolService
static final record
Deprecated. -
Constructor Summary
ConstructorsConstructorDescriptionLC4jToolService
(Map<dev.langchain4j.agent.tool.ToolSpecification, dev.langchain4j.service.tool.ToolExecutor> toolMap) -
Method Summary
Modifier and TypeMethodDescriptionstatic LC4jToolService.Builder
builder()
Optional<dev.langchain4j.data.message.ToolExecutionResultMessage>
execute
(dev.langchain4j.agent.tool.ToolExecutionRequest request) Executes the first matching toolOptional<dev.langchain4j.data.message.ToolExecutionResultMessage>
Executes the first matching toolOptional<dev.langchain4j.data.message.ToolExecutionResultMessage>
execute
(Collection<dev.langchain4j.agent.tool.ToolExecutionRequest> requests) Executes the first matching toolOptional<dev.langchain4j.data.message.ToolExecutionResultMessage>
execute
(Collection<dev.langchain4j.agent.tool.ToolExecutionRequest> requests, Object memoryId) Executes the first matching toolList<dev.langchain4j.agent.tool.ToolSpecification>
Returns a list ofToolSpecification
s that can be executed by this node
-
Constructor Details
-
LC4jToolService
public LC4jToolService(Map<dev.langchain4j.agent.tool.ToolSpecification, dev.langchain4j.service.tool.ToolExecutor> toolMap)
-
-
Method Details
-
builder
-
toolSpecifications
Returns a list ofToolSpecification
s 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) 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) 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) 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) Executes the first matching tool- Parameters:
requests
- the requests to execute- Returns:
- the result of the tool
-
Map.Entry<dev.langchain4j.agent.tool.ToolSpecification,dev.langchain4j.service.tool.ToolExecutor>
instead