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 class
Represents 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()
int
hashCode()
result()
The result of the guardrailstatic InputGuardrailResult
success()
Gets a successful input guardrail resultThe message of the successful resultstatic InputGuardrailResult
successWith
(String successfulText) Produces a successful result with specific success texttoString()
userMessage
(InputGuardrailRequest params) Gets theUserMessage
computed from the combination of the originalUserMessage
in theInputGuardrailRequest
and this resultMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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:GuardrailResult
The result of the guardrail- Specified by:
result
in interfaceGuardrailResult<InputGuardrailResult>
-
successfulText
Description copied from interface:GuardrailResult
The message of the successful result- Specified by:
successfulText
in interfaceGuardrailResult<InputGuardrailResult>
-
failures
- Specified by:
failures
in interfaceGuardrailResult<InputGuardrailResult>
- Returns:
- The list of failures eventually resulting from a set of validations.
-
toString
-
userMessage
Gets theUserMessage
computed from the combination of the originalUserMessage
in theInputGuardrailRequest
and this result- Parameters:
params
- The input guardrail params- Returns:
- A
UserMessage
computed from the combination of the originalUserMessage
in theInputGuardrailRequest
* and this result
-
equals
-
hashCode
public int hashCode()
-