Package dev.langchain4j.guardrail
Interface GuardrailRequest<P extends GuardrailRequest<P>>
- All Known Implementing Classes:
InputGuardrailRequest
,OutputGuardrailRequest
public sealed interface GuardrailRequest<P extends GuardrailRequest<P>>
permits InputGuardrailRequest, OutputGuardrailRequest
Represents the parameter passed to
Guardrail.validate(GuardrailRequest)
} in order to validate an interaction
between a user and the LLM.-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the common parameters that are shared across guardrail checks.Recreate this guardrail param with the given input or output text.
-
Method Details
-
requestParams
GuardrailRequestParams requestParams()Retrieves the common parameters that are shared across guardrail checks.- Returns:
- an instance of
GuardrailRequestParams
containing shared parameters such as chat memory, user message template, and additional variables.
-
withText
Recreate this guardrail param with the given input or output text.- Parameters:
text
- The text of the rewritten param.- Returns:
- A clone of this guardrail params with the given input or output text.
-