Skip to content

Add support for custom Tool error handlers #2008

@sabob

Description

@sabob

Hi all,

In langchain4j AIServices one can customize the behavior of
ToolArgumentsErrorHandler and ToolExecutionErrorHandler as follows:

return AiServices.builder(MyAgent.class)
     .toolArgumentsErrorHandler((throwable, toolErrorContext) ->
       ToolErrorHandlerResult.text("*Boom!")
    )
      .toolExecutionErrorHandler((throwable, toolErrorContext) -> {
         throw new MyBusinessError("Boom");
      })
      .build();

Is this something Quarkus-Langchian4j can support?

ToolArgumentsErrorHandler is important to us.
We use Jakarta Validation and without a custom toolArgumentsErrorHandler, the LLM receives a ConstraintViolationException and stacktrace if bad arguments are passed to a tool method.

Kind regards

Bob

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions