Interface GuardrailResult<GR extends GuardrailResult<GR>>

Type Parameters:
GR - The type of guardrail result to expect
All Known Implementing Classes:
InputGuardrailResult, OutputGuardrailResult

public sealed interface GuardrailResult<GR extends GuardrailResult<GR>> permits InputGuardrailResult, OutputGuardrailResult
The result of the validation of an interaction between a user and the LLM.
See Also:
  • Method Details

    • result

      The result of the guardrail
    • failures

      <F extends GuardrailResult.Failure> List<F> failures()
      Returns:
      The list of failures eventually resulting from a set of validations.
    • successfulText

      String successfulText()
      The message of the successful result
    • hasRewrittenResult

      default boolean hasRewrittenResult()
      Whether or not the result is successful, but the result was re-written, potentially due to re-prompting
    • isFatal

      default boolean isFatal()
      Whether or not the result is considered fatal
    • isSuccess

      default boolean isSuccess()
      Whether or not the result is considered successful
    • getFirstFailureException

      default Throwable getFirstFailureException()
      Gets the exception from the first failure
    • validatedBy

      default GR validatedBy(Class<? extends Guardrail> guardrailClass)
      The Guardrail class which performed this validation
    • asString

      default String asString()