Class ToolCallLimitExceededException
- All Implemented Interfaces:
Serializable
A model that keeps requesting tool calls instead of answering never ends the
turn on its own, and each round costs another model call. Both built-in
providers therefore end such a turn with this exception.
LangChain4JLLMProvider runs the tool-calling loop itself and throws
once the model has requested more calls to any one tool, or more tool calls
in total, than LangChain4JLLMProvider.setMaxCallsPerTool(int) and
LangChain4JLLMProvider.setMaxTotalToolCalls(int) allow; none of the
tool calls of the refused round are executed, and the model is not called
again. SpringAILLMProvider throws when Spring AI, which runs the loop
itself, stops it at its own limits. You receive the exception as the error of
the turn, through
ResponseEvent.getError() in the
ResponseListener and in
AIController.onResponse.
The message names the limit that was exceeded, and the
tool when the limit was a per-tool one, in the words of the framework that
enforced it.
- Since:
- 25.4
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionToolCallLimitExceededException(String message) Creates a new exception for a tool call limit exceeded during a turn. -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ToolCallLimitExceededException
Creates a new exception for a tool call limit exceeded during a turn. The built-in providers create it; the constructor is public so that you can construct one when unit testing aResponseListeneror anAIController, or throw it from a customLLMProviderthat bounds its own tool-calling loop.- Parameters:
message- a description of the limit that was exceeded
-