Class DefaultToolExecutor

java.lang.Object
dev.langchain4j.service.tool.DefaultToolExecutor
All Implemented Interfaces:
ToolExecutor

public class DefaultToolExecutor extends Object implements ToolExecutor
  • Constructor Details

    • DefaultToolExecutor

      public DefaultToolExecutor(Object object, Method method)
    • DefaultToolExecutor

      public DefaultToolExecutor(Object object, ToolExecutionRequest toolExecutionRequest)
    • DefaultToolExecutor

      public 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. Therefore, access to the original method is required to retrieve those names.
      Parameters:
      object - the object on which the method should be invoked
      originalMethod - the original method, used to retrieve parameter names and prepare arguments
      methodToInvoke - the method that should actually be invoked
  • Method Details

    • execute

      public String execute(ToolExecutionRequest toolExecutionRequest, Object memoryId)
      Description copied from interface: ToolExecutor
      Executes a tool requests.
      Specified by:
      execute in interface ToolExecutor
      Parameters:
      toolExecutionRequest - The tool execution request. Contains tool name and arguments.
      memoryId - The ID of the chat memory. See MemoryId for more details.
      Returns:
      The result of the tool execution.