Class OutputGuardrail.ValidationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
io.quarkiverse.langchain4j.guardrails.OutputGuardrail.ValidationException
- All Implemented Interfaces:
Serializable
- Enclosing interface:
- OutputGuardrail
An exception thrown when the validation fails.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionValidationException
(String message, boolean retry, String reprompt) Creates a new instance ofOutputGuardrail.ValidationException
without a cause.ValidationException
(String message, Throwable cause, boolean retry, String reprompt) Creates a new instance ofOutputGuardrail.ValidationException
with a cause. -
Method Summary
Modifier and TypeMethodDescriptionThe reprompt message.boolean
isRetry()
Whether the request should be retried.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ValidationException
Creates a new instance ofOutputGuardrail.ValidationException
without a cause.- Parameters:
message
- the error messageretry
- whether the request should be retriedreprompt
- if the request should be retried, the reprompt message. If null, the original request with the same context will be retried.
-
ValidationException
Creates a new instance ofOutputGuardrail.ValidationException
with a cause.- Parameters:
message
- the error messagecause
- the causeretry
- whether the request should be retriedreprompt
- if the request should be retried, the reprompt message. If null, the original request with the same context will be retried.
-
-
Method Details
-
isRetry
public boolean isRetry()Whether the request should be retried.- Returns:
- true if the request should be retried, false otherwise.
-
getReprompt
The reprompt message.If
isRetry()
returns true, the reprompt message (if notnull
is added to the LLM context and the request is retried. If the reprompt message isnull
, the original request with the same context.If
isRetry()
returns false, the reprompt message is ignored.- Returns:
- the reprompt message, or null if the original request with the same context should be retried.
-