Package dev.langchain4j.guardrail
Class InputGuardrailResult
java.lang.Object
dev.langchain4j.guardrail.InputGuardrailResult
- All Implemented Interfaces:
GuardrailResult<InputGuardrailResult>
public final class InputGuardrailResult
extends Object
implements GuardrailResult<InputGuardrailResult>
The result of the validation of an
InputGuardrail-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents an input guardrail failureNested classes/interfaces inherited from interface dev.langchain4j.guardrail.GuardrailResult
GuardrailResult.Result -
Method Summary
Modifier and TypeMethodDescriptionboolean<F extends GuardrailResult.Failure>
List<F> failures()inthashCode()result()The result of the guardrailstatic InputGuardrailResultsuccess()Gets a successful input guardrail resultThe message of the successful resultstatic InputGuardrailResultsuccessWith(String successfulText) Produces a successful result with specific success texttoString()userMessage(InputGuardrailRequest params) Gets theUserMessagecomputed from the combination of the originalUserMessagein theInputGuardrailRequestand this resultMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.langchain4j.guardrail.GuardrailResult
asString, getFirstFailureException, hasRewrittenResult, isFatal, isSuccess, validatedBy
-
Method Details
-
success
Gets a successful input guardrail result -
successWith
Produces a successful result with specific success text- Parameters:
successfulText- The text of the successful result.- Returns:
- The result of a successful input guardrail validation with a specific text.
-
result
Description copied from interface:GuardrailResultThe result of the guardrail- Specified by:
resultin interfaceGuardrailResult<InputGuardrailResult>
-
successfulText
Description copied from interface:GuardrailResultThe message of the successful result- Specified by:
successfulTextin interfaceGuardrailResult<InputGuardrailResult>
-
failures
- Specified by:
failuresin interfaceGuardrailResult<InputGuardrailResult>- Returns:
- The list of failures eventually resulting from a set of validations.
-
toString
-
userMessage
Gets theUserMessagecomputed from the combination of the originalUserMessagein theInputGuardrailRequestand this result- Parameters:
params- The input guardrail params- Returns:
- A
UserMessagecomputed from the combination of the originalUserMessagein theInputGuardrailRequest* and this result
-
equals
-
hashCode
public int hashCode()
-