Class CorrectableRuntimeLLMException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
ai.redouble.nucleo.harness.errors.LLMReadableRuntimeException
ai.redouble.nucleo.harness.errors.CorrectableRuntimeLLMException
- All Implemented Interfaces:
LLMReadable, LLMReadableException, Serializable
Runtime (unchecked) exception indicating the LLM's input was wrong and it may fix
its parameters and retry.
This is the unchecked counterpart of CorrectableLLMException. Use when
checked exceptions are impractical but the error is still correctable by the LLM.
Example usage:
// In a stream operation where checked exceptions can't be thrown
items.stream().map(item -> {
try {
return Integer.parseInt(item);
} catch (NumberFormatException e) {
throw new CorrectableRuntimeLLMException(
"Parameter 'items' contains non-integer value: " + item, e);
}
});
- Since:
- 0.1 (2026-03-13)
- Author:
- Andrey Santrosyan
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCorrectableRuntimeLLMException(String llmMessage) Constructs a correctable runtime exception with the specified LLM message.CorrectableRuntimeLLMException(String llmMessage, Throwable cause) Constructs a correctable runtime exception with the specified LLM message and cause. -
Method Summary
Modifier and TypeMethodDescriptionExplains the error to the LLM for inclusion in the conversation context.final booleanIndicates whether the LLM may retry the same tool with different input.Methods inherited from class LLMReadableRuntimeException
getLLMMessage, unwrapRuntimeMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CorrectableRuntimeLLMException
Constructs a correctable runtime exception with the specified LLM message.- Parameters:
llmMessage- clean, actionable error message for LLM understanding
-
CorrectableRuntimeLLMException
-
-
Method Details
-
isCorrectable
public final boolean isCorrectable()Description copied from interface:LLMReadableExceptionIndicates whether the LLM may retry the same tool with different input.true (correctable): The LLM's input was wrong. It may fix its parameters and call the same tool again.
false (uncorrectable): The tool itself cannot work right now, regardless of input. The LLM should try a different approach.
- Returns:
- true if correctable, false if uncorrectable
-
explainToLLM
Description copied from interface:LLMReadableExceptionExplains the error to the LLM for inclusion in the conversation context.The default implementation returns just the LLM message. Subclasses typically append a hint indicating whether the error is correctable or not, so the LLM knows whether to retry or try a different approach.
- Returns:
- full error explanation for the LLM
-