Class OutputGuardrailException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
dev.langchain4j.exception.LangChain4jException
dev.langchain4j.guardrail.GuardrailException
dev.langchain4j.guardrail.OutputGuardrailException
- All Implemented Interfaces:
Serializable
Exception thrown when an output guardrail validation fails.
This class is not intended to be thrown within guardrail implementations. It is for the framework only. It is ok to catch it.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOutputGuardrailException(String message) OutputGuardrailException(String message, Throwable cause) OutputGuardrailException(String message, Throwable cause, OutputGuardrailResult result) -
Method Summary
Modifier and TypeMethodDescriptionresult()Returns theOutputGuardrailResultthat caused this exception, ornullif not available.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
OutputGuardrailException
-
OutputGuardrailException
-
OutputGuardrailException
-
-
Method Details
-
result
Returns theOutputGuardrailResultthat caused this exception, ornullif not available. Callers catching this exception can inspect the result to understand which guardrail failed and whether the violating message was removed from memory.
-