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 ofGuardrailsConfig
to use for configurationP
- The type ofGuardrailRequest
to validateR
- The type ofGuardrailResult
to returnG
- The type ofGuardrail
s 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()
TheGuardrailsConfig
to 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()TheGuardrailsConfig
to use for configuration of the guardrail execution- Returns:
- The
GuardrailsConfig
to 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
- TheGuardrailRequest
to validate- Returns:
- The
GuardrailResult
of the validation
-