Package dev.langchain4j.service.tool
Class DefaultToolExecutor
java.lang.Object
dev.langchain4j.service.tool.DefaultToolExecutor
- All Implemented Interfaces:
ToolExecutor
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultToolExecutor
(Object object, ToolExecutionRequest toolExecutionRequest) DefaultToolExecutor
(Object object, Method method) DefaultToolExecutor
(Object object, Method originalMethod, Method methodToInvoke) When methods annotated with @Tool are wrapped into proxies (AOP), the parameters of the proxied method do not retain their original names. -
Method Summary
Modifier and TypeMethodDescriptionexecute
(ToolExecutionRequest toolExecutionRequest, Object memoryId) Executes a tool requests.
-
Constructor Details
-
DefaultToolExecutor
-
DefaultToolExecutor
-
DefaultToolExecutor
When methods annotated with @Tool are wrapped into proxies (AOP), the parameters of the proxied method do not retain their original names. Therefore, access to the original method is required to retrieve those names.- Parameters:
object
- the object on which the method should be invokedoriginalMethod
- the original method, used to retrieve parameter names and prepare argumentsmethodToInvoke
- the method that should actually be invoked
-
-
Method Details
-
execute
Description copied from interface:ToolExecutor
Executes a tool requests.- Specified by:
execute
in interfaceToolExecutor
- Parameters:
toolExecutionRequest
- The tool execution request. Contains tool name and arguments.memoryId
- The ID of the chat memory. SeeMemoryId
for more details.- Returns:
- The result of the tool execution.
-