Package dev.langchain4j.guardrail
Interface GuardrailExecutor<C extends GuardrailsConfig,P extends GuardrailRequest,R extends GuardrailResult<R>,G extends Guardrail<P,R>>
- Type Parameters:
C- The type ofGuardrailsConfigto use for configurationP- The type ofGuardrailRequestto validateR- The type ofGuardrailResultto returnG- The type ofGuardrails being executed
- All Known Implementing Classes:
AbstractGuardrailExecutor,InputGuardrailExecutor,OutputGuardrailExecutor
public sealed interface GuardrailExecutor<C extends GuardrailsConfig,P extends GuardrailRequest,R extends GuardrailResult<R>,G extends Guardrail<P,R>>
permits AbstractGuardrailExecutor<C,P,R,G,F>
Represents a mechanism to execute a set of guardrails on given parameters.
This interface defines the contract for validating interactions (input or output)
using multiple guardrails.
-
Method Summary
Modifier and TypeMethodDescriptionconfig()TheGuardrailsConfigto use for configuration of the guardrail executionExecutes the provided guardrails on the given parameters.Retrieves the guardrails associated with the implementation.
-
Method Details
-
config
C config()TheGuardrailsConfigto use for configuration of the guardrail execution- Returns:
- The
GuardrailsConfigto use for configuration of the guardrail execution
-
guardrails
Retrieves the guardrails associated with the implementation.- Returns:
- The guardrails which can be used for validating inputs or outputs against predefined rules.
-
execute
Executes the provided guardrails on the given parameters.- Parameters:
params- TheGuardrailRequestto validate- Returns:
- The
GuardrailResultof the validation
-