Interface ToolArgumentsErrorHandler

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ToolArgumentsErrorHandler
Handler for ToolArgumentsExceptions thrown by a ToolExecutor.

Currently, there are two ways to handle errors:

1. Throw an exception: this will stop the AI service flow.

2. Return a text message (e.g., an error description) that will be sent back to the LLM, allowing it to respond appropriately (for example, by correcting the error and retrying).

Since:
1.4.0
See Also:
  • Method Details

    • handle

      Handles an error that occurred during the parsing and preparation of tool arguments.

      This method should either throw an exception or return a ToolErrorHandlerResult.text(String), which will be sent to the LLM as the result of the tool execution.

      Parameters:
      error - The actual error that occurred.
      context - The context in which the error occurred.
      Returns:
      The result of error handling.